Failed to upload File in linux. tmp_name is blank

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.