Last updated November 4, 2015. Created on November 4, 2015.
Edited by tvn. Log in to edit this page.

FileField checks several server configuration options to help the administrator configure the field correctly. It is simple to configure a maximum upload size, but often times the server configuration prevents the administrator from increasing the size to the desired level. If the server configuration is limiting the value of the field, you may need to adjust the server configuration to allow larger sizes.


An example of the server configuration preventing a larger upload size. Though the administrator might increase the value to 20M, the server will still restrict the user to only 2M.

Increasing the Limit on Your Server

There are many approaches to increasing the maximum upload size on your server, even if you don't have root access or if you're on a shared host. Below is a list of possible ways to increase the upload size.

Change the settings in php.ini

If you have root access on your machine, this is the most reliable and universal approach to increasing the maximum file upload. Find the php.ini file. The most common location for php.ini is /etc/php.ini. If the file is not there, you can determine where php.ini lives by using the phpinfo() function. This reference at PHP scripts might help find the php.ini file using phpinfo().

Once you've located php.ini, there are two settings you need to change, the max post size and max file upload size.

; Maximum size of POST data that PHP will accept.
post_max_size = 2M

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Change these values to the maximum upload size you would like to allow. After making the changes check that the changes have been applied by checking phpinfo() or the

Create your own local php.ini file

Many shared hosts allow you to create your own minature php.ini file that overrides the defaults of the main server php.ini file.

This approach is known to work with the following hosts:

This file usually resides in the public_html directory of your site, in the cgi-bin, or in your home directory. If the file doesn't exist, just create a new text file named php.ini and include the following text:

; Maximum size of POST data that PHP will accept.
post_max_size = 2M

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Change these values to the maximum upload size you would like to allow.

Change the settings in .htaccess

On hosts that do not allow local php.ini files, many will let you change settings in .htaccess files. Drupal comes with an .htaccess file that should be uploaded to your server in the root of the Drupal installation. You may edit this file to set additional settings.

This approach is known to work with the following hosts:

Between lines 25 and 53 (in Drupal 6) there are configuration sections such as this:

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  .....
</IfModule>

Drupal already sets several settings in this file, be sure to add the setting to the appropriate section based on your version of Apache and PHP. If you're not sure what version you're using, it's safe to add these values to all three sections (PHP 4, Apache 1; PHP 4, Apache 2; PHP 5, Apache 1 and 2).

  php_value post_max_size                   2M
  php_value upload_max_filesize             2M

Change these values to the maximum upload size you would like to allow.

Using ini_set() in settings.php

Although many other PHP settings are configurable by using ini_set() in the settings.php file, the post_max_size and upload_max_filesize options are not useful to change with this method, since the settings.php file is not loaded until after the file has been uploaded. Try using the php.ini or .htaccess approach.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.