PHP - Maximum Total Upload Size?

2019-01-18 00:24发布

I have a php web page with 15 fields. The user will use it to upload images. I tested this by uploading 15 jpg images, each about 2 M, without any problems. On the day I launch, I will be moving this web page to another Linux shared hosting environment (still not sure which). Are there some web hosting environments that limit the size of total uploads in one http request?

标签: php upload limit
9条回答
ら.Afraid
2楼-- · 2019-01-18 00:42

If you are using nginx then make sure that you have the following:

server {
...
     client_max_body_size 100M;
....
}
查看更多
来,给爷笑一个
3楼-- · 2019-01-18 00:45

This would be unusual, but of course, check with whatever hosting company you choose. If there were a limit, it certainly would be higher than 30 MB.

查看更多
ゆ 、 Hurt°
4楼-- · 2019-01-18 00:54

the php.ini directive "post_max_size" should limit how much data you can send in a single POST. if you post 15 images in one post I'm pretty sure that is still considered one POST. So it might be good to check this value before going live.

查看更多
Summer. ? 凉城
5楼-- · 2019-01-18 00:54

Yes. There are (as far as I can remember) three or so configuration settings which will affect upload size restrictions:

  • upload_max_filesize, which sets an upper limit on the size of uploaded files
  • post_max_size, which limits the total size of posted data, including file data
  • max_input_time, which restricts the length of time the script is allowed to process input data, including posted values

upload_max_filesize is a limit on each individual file; however, max_post_size is an upper limit on the entire request, which includes all the uploaded files.

Different hosting environments will have these values set differently, which may affect your abilities upon deployment.

查看更多
一夜七次
6楼-- · 2019-01-18 00:54

The upload limits are set through php ini. You can try get them like so:

$post_max_size = ini_get('post_max_size');
$upload_max_filesize = ini_get('upload_max_filesize');
查看更多
乱世女痞
7楼-- · 2019-01-18 00:55

It's a setting in php.ini. You can look in the output of php info for the field labeled "upload_max_filesize". To get a php info page, create a php file with the following code:

<?php phpinfo(); ?>

This post at php.net gives you sample code to get that information, and the rest of the page is a treasure trove of php configuration options.

查看更多
登录 后发表回答