|
<head>
<title>Uploading...</title>
</head>
<body>
<font color="555555" size+=9>Uploading...</font>
<br><br>
<?
if($uploadfile=="none")
{
echo "ERROR: no file upload.";
exit;
}
if($_FILES['uploadfile']['size']==0)
{
echo "ERROR: file is zero length.";
exit;
}
if($_FILES['uploadfile']['type']!="text/plain")
{
echo "ERROR: file is not plain text.";
exit;
}
if(!is_uploaded_file($uploadfile))
{
echo "ERROR: possible file upload attack.";
exit;
}
$upfile="/usr/local/apache/htdocs/personal/".$_FILES['uploadfile']['name'];
if(!move_uploaded_file($_FILE['uploadfile']['tmp_name'],$upfile))
{
echo "ERROR: could not move file into directory.";
exit;
}
echo "File uploaded successfully.<br><br>";
?>
</body>
</html>
it always say that:ERROR: file is zero length. why?
upload.html code:
<html>
<head>
<title>Upload</title>
</head>
<body>
<center>
<font color="55555" size+=9>Upload programme and file</font>
</center>
<hr width="70%" size=2>
<br><br>
<form type="multipart/form-data" action="upload.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000">
Upload this file:<input name="uploadfile" type="file">
<input type="submit" value="Upload">
</form>
</body>
</html> |
|