Ver Mensaje Individual
  #13 (permalink)  
Antiguo 25/05/2009, 20:41
Avatar de chulifo
chulifo
 
Fecha de Ingreso: abril-2009
Ubicación: perdido en codigos del PHP, pero aprendo rapido!
Mensajes: 524
Antigüedad: 15 años, 1 mes
Puntos: 18
Respuesta: Ayuda a completar mi sistema fileupload

miren Triby tenias razon habia un error hay pero sigue mal igua aka les dejo una imagen

1: son los archivos en la carpeta
2: el error q me tira
3:el codigo que uso para e pop up!

y de todas formas aka esta mis codigos de new

index.php

<head>
<script language="JavaScript">
function Abrir_ventana (pagina) {
var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=500, height=300, top=85, left=140";
window.open(pagina,"",opciones);
}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File Manager</title>
<script src='texts.js'></script>
<style type="text/css">
<!--
.style1 {
font-size: 18px;
font-weight: bold;
}
a:link {
color: #FFFFFF;
}
a:visited {
color: #FFFFFF;
}
a:hover {
color: #FF0000;
}
a:active {
color: #FFFFFF;
}
-->
</style>
</head>

<body>
<form enctype="multipart/form-data" action="<?=$PHP_SELF?>subir.php" method="POST">
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
selecciona los archivos que quieres subir</p>
<p>
<input name="uploadedfile" type="file" />
</p>
<p>
<input name="uploadedfile2" type="file" />
</p>
<p>
<label></label>
<br />
<input type="submit" value="Subir Mi Archivo" />
</p>

</form>
Actualemte Estos son los archivos existentes
<p>

<? $dir = new DirectoryIterator('files');//Aqui se indica la ruta
while($dir->valid()) {
if(!$dir->isDot()) {
$num++;
print("<TD bgcolor=#FFCCFF>"."<a href=javascript:Abrir_ventana('borrar.php?$dir') ><img src=\"images.jpg\" /></font></a>"."</TD>\n");
}

$dir->next('$files');

}
?>
</p>
</body>
</html>


subir.php


<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
a:link {
color: #000000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #FF0000;
}
a:active {
text-decoration: none;
color: #000000;
}
-->
</style></head>

<body>
<?php
// Where the file is going to be placed
$target_path = "files/";

/* Add the original filename to our target path.
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

$target_path = "files/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "El Archivo ". basename( $_FILES['uploadedfile']['name']).
"\r\n\r\n.Subio exitosamente \r\n\r\n.";
} else{
echo "error en el upload 1. \r\n\r\n.";
}

// Where the file is going to be placed
$target_path = "files/";

/* Add the original filename to our target path.
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile2']['name']);

$target_path = "files/";

$target_path = $target_path . basename( $_FILES['uploadedfile2']['name']);

if(move_uploaded_file($_FILES['uploadedfile2']['tmp_name'], $target_path)) {
echo "EL Archivo ". basename( $_FILES['uploadedfile2']['name']).
"Subio exitosamente \r\n\r\n.";
} else{
echo "error en el upload2. \r\n\r\n.";
}
//aki se seecciona los archivos XD solo asi me acuerdo!

?>
<p><strong> <a href="index.php"><em>Vuelve para ver tus archivos</em></a></strong></p>
</body>
</html>


borrar.php

<?php
unlink("$files/$dir");
?>


pero aganlo ustedes y corrigen despues me dan la solucion porfavor!

edito aka esta la imagen
h t t p : / / n e t w o r k o n l i n e . z o b y h o s t . c o m / D i b u j o . b m p

Última edición por chulifo; 25/05/2009 a las 20:49