PHP configuration file settings to upload large files

WBOY
Release: 2016-07-25 08:54:17
Original
1093 people have browsed it
Share the method of modifying the PHP configuration file to set up large file uploads to break through PHP large file upload restrictions. Interested friends can refer to it.

Contents of this section: Set the large file upload option in the php configuration file.

To upload large files to the server, it is recommended to use the flash long-distance transfer component (within 100M is still good) swfupload.

PHP upload files cannot meet this requirement by default. Please refer to the following method to modify it.

1. General PHP file upload, unless the file is very small. Like a 5M file, it will probably take more than a minute to upload. But in PHP, the default maximum execution time of this page is 30 seconds. That is to say, if it exceeds 30 seconds, the script will stop executing. This results in the inability to open the web page. At this time we can modify max_execution_time Search in php.ini max_execution_time

Default is 30 seconds. Change to max_execution_time = 0 0 means no limit The above modification is the script execution timeout in the php upload file

2. Modify post_max_size to set the maximum size allowed for POST data. This setting also affects PHP upload files. PHP's default post_max_size is 2M. If the POST data size is greater than post_max_size $_POST and $_FILES superglobals will be empty. Find post_max_size .Change to post_max_size = 150M

3. Many people will change the second step. But when uploading files in PHP, the maximum size is still 8M. Why? We also need to change a parameter upload_max_filesize to indicate the maximum size of the uploaded file. Find upload_max_filesize, the default is 8M and change to upload_max_filesize = 100M

In addition, when uploading PHP files, it is better for post_max_size to be larger than upload_max_filesize. With the above modifications, there should be no problem uploading large files via PHP files.



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!