PHP Modify File Upload Limit method Summary _php Tips

Source: Internet
Author: User
Tags file upload php file upload

PHP default upload limit is the maximum 2M, want to upload more than this set of files, need to adjust PHP, Apache and some other parameters. Below, we briefly introduce the PHP file upload some of the parameters involved:

File_uploads: Allow the switch to upload files via HTTP, which is on by default.

Upload_tmp_dir:upload_tmp_dir used to describe the temporary directory of files placed in PHP upload, to upload files, you have to ensure that the server does not turn off temporary files and have write permissions on the folder, if not specified then PHP use the system default values.

Upload_max_filesize: The maximum size allowed for uploading files, the default is 2M.

Post_max_size: Controls the maximum amount of data that PHP can receive when using the Post method for a form submission. If you want to use the php file upload feature, you need to change this value to be larger than upload_max_filesize.

Max_input_time: Limits the time to receive data by post, get, and put in seconds. If your application is running on a low speed link, you need to increase this value to accommodate the additional time required to receive data.

Memory_limit: To avoid running scripts that use the system's available memory heavily, PHP allows you to define memory usage limits. The value of the maximum memory capacity variable Memory_limit that a single script program can use is specified by the Memory_limit variable to be appropriately larger than the Post_max_size value.

Max_execution_time:max_execution_time sets the time, in seconds, before PHP waits for the script to finish executing before the script is forced to terminate. This variable is useful when the script enters an infinite loop state. However, when there is a legitimate activity that takes a long time to complete (such as uploading a large file), this feature can also cause the operation to fail. In such cases you must consider increasing the value of this variable to avoid PHP shutting down the script while the script is performing some important process.

For Linux hosts, there may be php.conf files underneath the/etc/httpd/conf.d/access.conf/, which may solve some of the system's file size limitations.

The above mentioned is the entire content of this article, I hope to be able to master the php file upload some help.

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.