How to upload multiple large files in php
I had uploaded three files to the server in php. Smaller files are uploaded correctly but开发者_开发问答 when uploading larger files I get an error.
How to upload large files in php?
If the smaller files are uploaded successfully but not the larger files, then most probably the problem is caused by the php.ini settings.
Did you check what is Maximum allowed size for uploaded files defined in your php.ini file? Find the following line in your php.ini file, there you can define the size. For example:
upload_max_filesize = 10M
You have to set your php.ini to accept larger file size: you are interested in two variables i think:
upload_max_filesize // the max size a file can have when uploaded
max_post_size //the max size of a POST call
Look here for reference
As Nicola points out, there are some variables in the php.ini you should look for:
For example, in php.ini:
memory_limit = 384M
post_max_size = 256M
upload_max_filesize = 200M
What Nicola didn't mention is that constraints may also be in place on your web server. If it's nginx
for example, you need to make adjustments to the configuration of your virtual host to support larger files ...
For nginx:
client_max_body_size 150m;
For Apache:
The apache webserver has a LimitRequestBody configuration directive that restricts the size of all POST data regardless of the web scripting language in use. Some RPM installations sets limit request body to 512Kb. You will need to change this to a larger value or remove the entry altogether.
increase the memory limit with .htaccess or ini_set()
function in php
精彩评论