{gdata title=|Missing screencast| app=|none|}
Though PHP presents a very versatile and user friendly interface for handling file uploads, the default installation is not geared for working with files in excess of 2 Mega Bytes. This article will help you configure your PHP engine for handling such large file transfers.
All the configuration settings for your PHP 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. However you cannot over ride some of the settings that effect file uploads with .htaccess directives in this way. So let's just concentrate on the ini file. If you do not have access to your PHP configuration file might have to contact your web hoosting service provider.
To find the location of your php.ini file and the current values for the following settings that we need to modify, please go to:
- Select Help → System Info from the drop-down menu on the Back-end of your Joomla! installation, then select the PHP Information tab.
- Select Site → Site information from the drop-down menu on the Back-end of your Joomla! installation, then select the PHP Information tab.
Look for these values:
file_uploads
upload_max_filesize
max_input_time
memory_limit
max_execution_time
post_max_size
The first one is fairly obvious if you set this off, uploading is disabled for your installation. We will cover the rest of the configuration settings in detail below.
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 set for upload_max_filesize
.
There is no recommended settings for these two directives because it really depends on what you want to allow your users to submit, but 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.
If you do not have access to php.ini
add the below to your .htaccess
file in your Joomla root directory and change the values according to your needs:
php_value upload_max_filesize 10M
php_value post_max_size 20M
--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.
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.