This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9017|Reply: 0

Notes on PHP upload maximum limits

[Copy link]
Posted on 2/13/2015 3:26:37 PM | | |

There is a problem when doing batch uploading images, after uploading multiple pictures at once, it is always unsuccessful, uploading 1 or 2 pictures alone can be successful, and then I found that the upload_max_filesize in the original php.ini is 4M, and the pictures I uploaded each have 1M, I think it may be a upload_max_filesize problem, and then I modified it to 50M, thinking it would be okay, but the upload was still unsuccessful, Then I opened firebug to view the post request, and found a piece of text, firebug reached the post request size limit, and later I found out that there was another parameter to set, that is, post_max_size, I also modified it to 50M, as long as the total amount of uploaded images did not exceed 50M, it could be successful.

What if you don't have permission to modify php.ini, some people say to use the ini_set() function, but upload_max_filesize, post_max_size, you can't use this function to set it directly in the script

Here's a summary of what often needs to be modified when uploading large files:
Open the php.ini and find it first
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
The following parameters affect the file upload:
file_uploads   =   on   ; Whether to allow file uploads over HTTP switches. By default, ON means on
upload_tmp_dir   ; Upload files to the place where temporary files are stored on the server, and use the default temporary folder if not specified
upload_max_filesize   =   8m   ; Wangwen Business, that is, the maximum file size allowed to be uploaded. The default is 2M

In the following
;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
Region, and one more:
post_max_size   =   8m ; It refers to the maximum value that can be received by POST to PHP through the form, including all values in the form. The default is 8M
Generally speaking, after setting the above four parameters, uploading a file with <=8M is not a problem, under normal network conditions.
But if you want to upload a large file > 8M, only the above four items will definitely work. Unless your network really has an upload speed of 100M/S, you still have to pay attention to the following parameters:

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time   =   600 ; The maximum time value (seconds) for each PHP page to run, the default is 30 seconds
max_input_time = 600 ; The maximum time it takes for each PHP page to receive data is 60 seconds by default
memory_limit   =   8m   ; The maximum memory eaten by each PHP page is 8M by default




Previous:HTTP Error 500.19 - Internal Server Error
Next:How to grab red envelopes scientifically: At the end of the year, you can get rich and write a program to grab red envelopes
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com