It is because of your server privacy and unique settings that some of you can not upload large files! You know the default installation is not geared for working with files exceeded from 2 Mega Bytes. So please read this article if you have problems with uploading large files to your server.

Ok if you have faced with such a problem you should go to your server and find a file named php.ini and edit it.

 

All the configuration settings for your installation are contained in the php.ini file. Sometimes these setting might be overridden by directives in apache .htaccess files or even with in the scripts themselves.

There are some paramaters inside this file but you should change just the last two of them:

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

 

By the way let's get familiar with all of them! The first one is fairly obvious if you set this "off", uploading is disabled in your server. So as you might have guessed you should not change its value! You should always set this "on". We will cover the rest of the configuration settings in detail below.

upload_max_filesize and post_max_size

Files are usually POSTed to the webserver in a format known as 'multipart/form-data'. The post_max_size sets the upper limit on the amount of data that a script can accept in this manner. Ideally this value should be larger than the value that you have set for upload_max_filesize.

It's important to realize that upload_max_filesize is the sum of the sizes of all the files that you are uploading. post_max_size is the upload_max_filesize plus the sum of the lengths of all the other fields in the form plus any mime headers that the encoder might include. Since these fields are typically small you can often approximate the upload max size to the post max size.

memory_limit

When the PHP engine is handling an incoming POST it needs to keep some of the incoming data in memory. This directive has any effect only if you have used the --enable-memory-limit option at configuration time. Setting too high a value can be very dangerous because if several uploads are being handled concurrently all available memory will be used up and other unrelated scripts that consume a lot of memory might effect the whole server as well.

max_execution_time and max_input_time

These settings define the maximum life time of the script and the time that the script should spend in accepting input. If several mega bytes of data are being transfered max_input_time should be reasonably high. 

 

What you should do

Ok good, now with all the above info in mind you need to change these paramaters in php.ini file in your server:

  • upload_max_filesize: You should change its value according to your favorite maximum size when uploading large size files.
  • max_execution_time: As the second probability this time value should be increased if you feel that the upload time might be exceeded from the default time value.

Add new comment


CAPTCHA Image