PHP - Maximum total upload size?

I have a php webpage 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. The day I start, I will transfer this webpage to another Linux sharing environment (still not sure which one). Are there some web hosting environments that limit the size of the shared load in a single HTTP request?

+6
php upload limit
source share
10 answers

Yes. There are (as far as I remember) three or so configuration settings that will affect download size limits:

  • 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 limits the time that the script is allowed to process input, including published values

upload_max_filesize - limit for each individual file; however max_post_size is the upper limit for the entire request, which includes all downloaded files.

In different hosting environments, these values ​​will be set differently, which may affect your deployment capabilities.

+19
source share

Load limits are set via php ini. You can try to get them like this:

 $post_max_size = ini_get('post_max_size'); $upload_max_filesize = ini_get('upload_max_filesize'); 
+6
source share

This is a parameter in php.ini. You can look in the php info output for the field with the inscription "upload_max_filesize". To get the php info page, create a php file with the following code:

 <?php phpinfo(); ?> 

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

+4
source share

There are many PHP settings that limit the loading process:

  • file_uploads
  • upload_max_filesize
  • max_input_time
  • memory_limit
  • max_execution_time
  • post_max_size

I would suggest reading this page: http://www.radinks.com/upload/config.php

Although this is true, many of them do not limit the size of the download, they impose a restriction on the loading process - for example, if the memory limit is too low, then you will have problems downloading large files that must remain in memory for a short period of time.

+4
source share

This would be unusual, but, of course, check with which hosting company you choose. If there was a limit, then, of course, it would be above 30 MB.

0
source share

The php.ini directive "post_max_size" should limit how much data you can send in one POST. if you post 15 images in one post, I'm sure it still counts as one POST. Therefore, it would be nice to check this value before you start living.

0
source share

If you are using nginx, make sure you have the following:

 server { ... client_max_body_size 100M; .... } 
0
source share

here:

 max_execution_time max_input_time memory_limit post_max_size upload_max_filesize max_file_uploads 
0
source share

You can check in php.ini (php setup) on your local host or hosting.

in configuration setting:

  • max_input_time
  • max_execution_time
  • memory_limit
  • post_max_size
  • max_file_uploads
  • upload_max_filesize
0
source share

I have seen the best solution so far here, and this is the code:

 /** * Returns the maximally uploadable file size in megabytes * * @return string */ function getMaxUploadSize() { $max_upload = (int)(ini_get('upload_max_filesize')); $max_post = (int)(ini_get('post_max_size')); $memory_limit = (int)(ini_get('memory_limit')); return min($max_upload, $max_post, $memory_limit); } 
-one
source share

All Articles