PHP File Upload encountered an issue (Move_uploaded_file)

Source: Internet
Author: User
Tags php file upload
PHP file Upload, with Move_uploaded_file This function can not move the file, and with copy or rename is indeed possible.

PHP file Upload, with Move_uploaded_file This function can not move the file, and with copy or rename is indeed possible. The document is more ambiguous, that is, move_uploaded_file this function, add a step check, check whether the file is HTTP POST upload. Later, in the source code to see the file name and PHP configuration in the Upload_tmp_dir this parameter to compare, if the file is under this directory, then Move_uploaded_file will move operations. And this comparison is case sensitive,/\ is not the same under Windows. 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.

On the other, note that is move_uploaded_file if configured as an unreachable path, Move_uploaded_file will never be able to move the file successfully, regardless of how it is handled.

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