An issue with uploading files in PHP

Source: Internet
Author: User
I have been very confused. In the document, said the more obscure, is move_uploaded_file this function, added a step check, check whether the file is HTTP POST upload,
As for, how to check the not said.
I google for a while, have not been able to solve the problem, do not know where the problem arises. Later, finally decided to look at the source code. Finally in the source code to see the file name and
PHP configuration in the Upload_tmp_dir this parameter to compare, if the file under this directory, then the move_uploaded_file will be moved operation. And this comparison is case sensitive,/\ is not the same under Windows. And in the PHP configuration file parsing, will call a Realpath function, that is to say, before you move_uploaded_file,
Must be to $file[' tmp_name '] = Realpath ($file [' tmp_name ']); Realpath, please.
There is another situation, we have to note that move_uploaded_file if configured as an inaccessible path, then you do not care, Move_uploaded_file always can not move the file successfully.

The above describes a upload php file upload a problem, including the content of the upload, I hope that the PHP tutorial interested in a friend helpful.

  • 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.