PHP File Upload Common defects

Source: Internet
Author: User
The value set for max_file_size cannot be greater than the value set by the Upload_max_filesize option in the INI setting. Its default value is 2M bytes.

If the memory limit setting is activated, you may need to set the memory_limit larger, and make sure that the Memory_limit settings are large enough.

If the value set by Max_execution_time is too small, the script may run longer than this setting. Therefore, please also ensure that the max_execution_time is large enough.

Note:max_execution_time only affects the time that the script itself runs. Any other time spent outside the script, such as calls to the system with the function system (), use of the sleep () function, database queries, file uploads, and so on, are not included when calculating the maximum time the script runs.

Warning:max_input_time sets the maximum time, in seconds, for the script to receive input, including file uploads. For large or multiple files, or if the user's network speed is slow, it may exceed the default of 60 seconds.

If the value set by the post_max_size is too small, the larger file cannot be uploaded. Therefore, make sure that the value of the post_max_size is large enough.

Not validating files that are being manipulated can mean that users can access sensitive information in other directories.

Please note that the CERN httpd seems to discard all the content after the first space in the Content-type MIME header information it obtains from the client, and based on this, CERN httpd does not support file upload features.

Given the many ways in which file paths are represented, we cannot ensure that file names (especially those containing spaces) that are used in various foreign languages can be handled correctly.

Developers should not mix common input fields and file-uploaded fields with the same form variable (for example, use foo[]).

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