An error occurred while uploading files in linux. tmp_name is empty.
Phpinfo displays the following information:
File_uploads On
Upload_max_filesize 2 M
Upload_tmp_dir/Users/ririn/Sites/tmp
Then I set the 777 permission for this directory chmod 777/Users/ririn/Sites/tmp. Is there anything else to set?
But I still cannot upload files.
First, the tmp directory does not contain any files.
Of course, $ tmp = $ _ FILES ['mypic '] ['tmp _ name'] is used in the background. this cannot be obtained either...
In win, the configuration in win is normal. the configuration here is the same as that in win. the selected file is only over 100 kB.
I still need to post my code, isn't it linux? what should I add?
$ Tmp = $ _ FILES ['mypic '] ['tmp _ name']; // empty
$ Name = $ _ FILES ['mypic '] ['name'];
$ Size = $ _ FILES ['mypic '] ['size'];
$ Arr = array (
'Tmp '=> $ tmp,
'Name' => $ name,
'Size' => $ size
);
Var_dump ($ arr );
?>
The last print is array (3) {["tmp"] => string (0) "" ["name"] => string (9) "scoot.png" ["size"] => int (0 )}
Windows is completely normal
Reply to discussion (solution)
You can directly print_r ($ _ FILE) on the php page pointed to by form to test whether there is any result.
Var_dump ($ _ FILES );
You can directly print_r ($ _ FILE) on the php page pointed to by form to test whether there is any result.
Ah, the result is like this.
Array (1) {["mypic"] => array (5) {["name"] => string (9) "scoot.png" ["type"] => string (0) "" ["tmp_name"] => string (0) "" ["error"] => int (2) ["size"] => int (0 )}}
There is nothing. there is only a file name.
Var_dump ($ _ FILES );
The result is as follows:
Array (1) {["mypic"] => array (5) {["name"] => string (9) "scoot.png" ["type"] => string (0) "" ["tmp_name"] => string (0) "" ["error"] => int (2) ["size"] => int (0 )}}
There is nothing. there is only a file name.
["Error"] => int (2)
Manual description
UPLOAD_ERR_FORM_SIZE
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.
I won't talk about it anymore.
["Error"] => int (2)
Manual description
UPLOAD_ERR_FORM_SIZE
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.
I won't talk about it anymore.
Well, I changed a file, but my original file is only 278 KB, but the upload_max_filesize I set is 2 MB.
Ah