
28/08/2002, 22:13
|
| | Fecha de Ingreso: febrero-2002
Mensajes: 57
Antigüedad: 23 años, 1 mes Puntos: 0 | |
Re: Upload con php, me estoy volviendo loco.... no, el server es tera-byte, si que esta activado el upload y no es gratuito. El permiso CHMOD777 a la carpeta esta dado.
el script:
<?
// $userfile is where file went on webserver
// $userfile_name is original file name
// $userfile_size is size in bytes
// $userfile_type is mime type e.g. image/gif
/* echo "Variables are:<br>";
echo $userfile." ".$userfile_name." ".$userfile_size." ".$userfile_type."<br>";
*/
if ($userfile=="none")
{
echo "Problem: no file uploaded";
exit;
}
if ($userfile_size==0)
{
echo "Problem: uploaded file is zero length";
exit;
}
if ($userfile_type != "text/plain")
{
echo "Problem: file is not plain text";
exit;
}
$upfile = "/home/sites/site41/web/upload/".$userfile_name;
if ( !copy($userfile, $upfile))
{
echo "Problem: Could not move file into directory";
exit;
}
echo "File uploaded successfully<br><br>";
$fp = fopen($upfile, "r");
$contents = fread ($fp, filesize ($upfile));
fclose ($fp);
$contents = strip_tags($contents);
$fp = fopen($upfile, "w");
fwrite($fp, $contents);
fclose($fp);
echo "Preview of uploaded file contents:<br><hr>";
echo $contents;
echo "<br><hr>";
?> |