Uploading large files using post parameters in PHP code

Source: Internet
Author: User
Tags php error php error log

Today, I ran into two colleagues who reacted to my failure to upload a large file (8M)!

is usually in PHP code to use the post parameters to upload files, when the size of the file is larger than 8M, upload cannot succeed.

First, I think of the Nginx client_max_body_size parameter, which defines the maximum value of the body of the HTTP request that Nginx receives. The value of Client_max_body_size setting in the nginx.conf configuration file is 8M. Increase this value, reload Nginx and then re-test. If the file still cannot be uploaded, the most probable cause of the error is the configuration of PHP.

Check the PHP error log, which contains the following records

PHP warning:post content-length of 8947356 bytes exceeds the limit of 8388608 bytes in Unknown on line 124

It is obvious that the post parameter maximum is also 8388608bytes (8M), modify the Post_max_size parameter value in php.ini, and restart the PHP-FPM service process to resolve the problem.

It is also important to note the file_uploads, upload_max_filesize, Memory_limit, and other parameter values in the php.ini configuration file.

Uploading large files using post parameters in PHP code

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.