Php files always fail to be uploaded; php files always fail to be uploaded.
Http://www.w3school.com.cn/php/php_file_upload.asp
I looked at this example, but when I was elected a file and clicked Upload, Error 6 appeared. I was in php. in ini, set upload_tmp_dir to upload_tmp_dir = "C: \ WX" and click upload to display the Invalid file. the file cannot be uploaded. Share:
------ Solution --------------------
In general, the upload and storage directories cannot be written. You have to set it up.
------ Solution --------------------
Index.html code
Http://www.w3.org/TR/html4/loose.dtd>
Untitled Document
Upload_file.php code:
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "
";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "Type: " . $_FILES["file"]["type"] . "
";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
------ Solution --------------------
You do not need to modify the content in php. ini. restore it and try again.
------ Solution --------------------
Reference:
Quote: reference:
Index.html code
Http://www.w3.org/TR/html4/loose.dtd>
Untitled Document
Upload_file.php code:
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "
";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "Type: " . $_FILES["file"]["type"] . "
";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
$ _ FILES ["file"]
Print the variable and check what it is.
print_r($_FILES["file"]);exit;
------ Solution --------------------
Error: 6
Indicates that the uploaded file does not exist.
You 'd better set upload_tmp_dir to D: that is, later Drive
Because C: Generally, the drive is set to prohibit file operations by anonymous users.
------ Solution --------------------
$ _ FILES ['file'] ['error']
The value is 0. If no error occurs, the file is uploaded successfully.
The value is 1, and the uploaded file exceeds the limit of the upload_max_filesize option in php. ini.
The value is 2, and the size of the uploaded file exceeds the value specified by the MAX_FILE_SIZE option in the HTML form.
The value is 3, and only part of the file is uploaded.
The value is 4 and no file is uploaded.
The value is 6 and the temporary folder cannot be found. PHP 4.3.10 and PHP 5.0.3 are introduced.
If the value is 7, the file fails to be written. PHP 5.1.0 is introduced.
If an error is reported, the temporary folder does not have the write permission or does not exist.
------ Solution --------------------
Http://www.w3.org/TR/html4/loose.dtd>
Untitled Document
Enctype = "multipart/form-data">
Filename: