Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP - Maximum Total Upload Size?

Tags:

php

upload

limit

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?

like image 231
John Avatar asked Apr 07 '09 21:04

John


People also ask

What is the max upload file size in PHP?

The default values for PHP will restrict you to a maximum 2 MB upload file size.

How can upload image more than 2mb in PHP?

To increaes file upload size in PHP, you need to modify the upload_max_filesize and post_max_size variable's in your php. ini file. In addition, you can also set the maximum number of files allowed to be uploaded simultaneously, in a single request, using the max_file_uploads . Note that from PHP 5.3.

How can I upload large files over 500mb in PHP?

By changing the upload_max_filesize limit in the php. ini file. By implementing file chunk upload, that splits the upload into smaller pieces an assembling these pieces when the upload is completed.


2 Answers

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, post_max_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.

like image 92
Rob Avatar answered Oct 07 '22 10:10

Rob


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');
like image 35
andi Avatar answered Oct 07 '22 11:10

andi