PHP - Ayuda Upload ficheros !!!!

 
Vista:

Ayuda Upload ficheros !!!!

Publicado por beto (1 intervención) el 14/10/2009 11:13:13
Buenas y gracias de ante mano por la ayuda ...

estoy intentando subir un fichero a mi servidor (Linux)
tengo 1 formulario y 1 script.

Index.php

<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />
<title>PHP upload - unijimpe</title>
<link href=\"estilo.css\" rel=\"stylesheet\" type=\"text/css\" />
</head>
<body>
<table width=\"413\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td width=\"413\" height=\"40\" class=\"titulo\">PHP upload - unijimpe </td>
</tr>
<tr>
<td class=\"text\">Por favor seleccione el archivo a subir:</td>
</tr>
<tr>
<form action=\"upload.php\" method=\"post\" enctype=\"multipart/form-data\">
<td class=\"text\">
<input name=\"archivo\" type=\"file\" class=\"casilla\" id=\"archivo\" size=\"35\" />
<input name=\"enviar\" type=\"submit\" class=\"boton\" id=\"enviar\" value=\"Upload File\" />
<input name=\"action\" type=\"hidden\" value=\"upload\" /> </td>
</form>
</tr>
<tr>
<td class=\"text\" style=\"color:#990000\"><?php echo $status; ?></td>
</tr>
<tr>
<td height=\"30\" class=\"subtitulo\">Listado de Archivos Subidos </td>
</tr>
<tr>
<td class=\"infsub\">
<?php
if ($gestor = opendir(\'files\')) {
echo \"<ul>\";
while (false !== ($arch = readdir($gestor))) {
if ($arch != \".\" && $arch != \"..\") {
echo \"<li><a href=\\\"files/\".$arch.\"\\\" class=\\\"linkli\\\">\".$arch.\"</a></li>\\n\";
}
}
closedir($gestor);
echo \"</ul>\";
}
?> </td>
</tr>
</table>
</body>
</html>

upload.php

<?php

$status = \"\";
if ($_POST[\"action\"] == \"upload\") {
// obtenemos los datos del archivo
$tamano = $_FILES[\"archivo\"][\'size\'];
$tipo = $_FILES[\"archivo\"][\'type\'];
$archivo = $_FILES[\"archivo\"][\'name\'];
$prefijo = substr(md5(uniqid(rand())),0,6);

if ($archivo != \"\") {
// guardamos el archivo a la carpeta files
$destino = \"files/\".$prefijo.\"_\".$archivo;
if (move_uploaded_file($_FILES[\'archivo\'][\'tmp_name\'],$destino)) {
$status = \"Archivo subido: <b>\".$archivo.\"</b>\";
} else {
$status = \"Error al subir el archivo\";
}
} else {
$status = \"Error al subir archivo\";
}
}
?>

Cuando doy a Upload file se me carga un error q me dice :

Fatal error: Unknown: Failed opening required \'/web/practica2/upload.php\' (include_path=\'.:/usr/share/php5:/usr/share/php5/PEAR\') in Unknown on line 0

Como soluciono este y error y ago que termine de subirlo ??? :D gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:Ayuda Upload ficheros !!!!

Publicado por Gabriel (30 intervenciones) el 14/10/2009 18:49:50
Hola!.

Este es un ejemplo completo y antes de subirlo lo probè en localhost.

el unico requisito es que absolutamente todos los archivos deben estar en el mismo host, ya sea localhost o tu dominio.

http://www.box.net/shared/8y82lx4f9l

Suerte!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar