Last updated January 25, 2013. Created by gpk on November 12, 2006.
Edited by 1q84, thomasmurphy, aaronbauman, dman. Log in to edit this page.

note: increasing PHP upload size is different from increasing PHP memory limit. You can learn to increase memory limit here.

Drupal's limits on upload file size are determined by your server's PHP settings (as well as Drupal specified settings that can be set at Admin > Site Configuration > File Upload). The default values for PHP will restrict you to a maximum 2 MB upload file size.

On the settings page for the upload module, Drupal calculates and displays the maximum file size that you can set based upon two PHP settings: 'post_max_size' and 'upload_max_filesize'. Since 'post_max_size' is the limit for all the content of your post, many people choose 'post_max_size' to be a multiple of 'upload_max_filesize' to allow multiple files to be uploaded, but this is not essential. The upload module limits the size of a single attachment to be less than either post_max_size, or upload_max_filesize, whichever is smaller. The default PHP values are 2 MB for upload_max_filesize, and 8 MB for post_max_size.

Depending on your host, changing these two PHP variables can be done in a number of places with the most likely being php.ini or .htaccess (depending on your hosting situation).

For example, to increase the limit on uploaded files to 10 MB:

  • Add the below to the relevant php.ini file (recommended, if you have access). Note that for some hosts this is a system-wide setting. However, for hosts running PHP as a CGI script with suexec (for example) you may be able to put these directives in a php.ini file in your Drupal root directory.
    • upload_max_filesize = 10M
    • post_max_size = 10M
  • Add the below to your .htaccess file in your Drupal root directory.
    • php_value upload_max_filesize 10M
    • php_value post_max_size 10M

The PHP documentation states that the memory_limit setting also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size. If this is an issue, see the page on how to Increase memory available to PHP (3 methods)

Drupal also allows/enforces its own size limits, independently of what PHP allows. These are found in Drupal 6 at "Administer » Site configuration » File uploads" ( /admin/settings/uploads ). The Drupal settings cannot be larger than those permitted by PHP, but may be smaller if you haven't updated them, so remember to check there also, after updating the php.ini.

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

Comments

If your changing your php.ini, and your having troubles (server keeps throwing errors) using the examples above, remove the ; from your php.ini files so it looks like this:

upload_max_filesize = 10M
post_max_size = 20M

It was the darned semicolons that were doing me in. Thanks for the tip!

Hi. I'm using a free host (include Apache 2, PHP 5, MySQL 5).

I could not find php.ini file in my Drupal folder. I searched and http://forum.siteground.com/showthread.php?t=2144 told me to create a blank php.ini, I placed it in my Drupal root folder. I have set the value:

upload_max_filesize = 10M
post_max_size = 20M

First, it didn't work. In Upload module config page, I changed the "Default maximum file size per upload: " to
10MB and it showed me"
"Your PHP settings limit the maximum file size per upload to 1.46 MB.
Depending on your server environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory."

Then, I went to edit the .htaccess file. I put

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
...
php_value upload_max_filesize 10M
php_value post_max_size 20M
...
</IfModule>

I saved it and I changed the "Default maximum file size per upload: " to 10MB but it kept show me
"Your PHP settings limit the maximum file size per upload to 1.46 MB.
Depending on your server environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory."

How can I fix it? I'm still a newbie to Drupal.

In Ubuntu, the apache2 php.ini file is located in

/etc/php5/apache2/php.ini

To make it work, I had to change the parameters

post_max_size = 8M
upload_max_filesize = 2M

to

post_max_size = 100M
upload_max_filesize = 100M

there and then restart apache2 (sudo /etc/init.d/apache2 restart). Since I use not only Drupal but also MediaWiki (which also uses PHP for its file uploads and therefore has the same limits), changing this php.ini configuration file solved my upload problems for both systems.

Perspectoff
Ubuntuguide.org/wiki/Kubuntuguide

I tried to fix as suggested above... could it be I am running to many CCK modules and there is sharing issues or something?

I figure I have configured simple gallery wrong, but I have double checked. I keep getting a

ERROR message like this when I try to upload:
An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (10 MB) that this server supports.

No matter what I do to the php.ini file or the file upload settings !

I have tried over riding with Tweaks.module also but to no avail

Please help, very frustrating.

I am using xampp and my php.ini file is sitting in the php folder.

Hi,
I figured that there are 3 control point. We forgot about the 3rd one - editor. I am using IMCE and --that is place where I increased the file limits and everything is fine. Now I can upload 16 MB and I have 1000 Mb users folder size.

To summarize, check:
1) php.ini file
2) Home » Administer » Site configuration » File uploads (/admin/settings/uploads)
3) Home » Administer » Site configuration » IMCE (admin/settings/imce/)

Hope it helps,
Vjeko

I'm running Drupal 6.16 and logged in as the Admin, the following path is not available: admin/settings/uploads . Why is this? I see many references refer to this path, but it's not available.

The settings in my php.ini file has been increased, as well as, my "Maximum file size per upload" in IMCE (admin/settings/imce/) for my user account. I've also changed the File Size in the Content Type, yet it still shows as only allowing 8MB. Rebooted apache as well.

Any more suggestions for how to increase the file size for my content type?

Thanks.

Just enable the core upload module and you will be able to access that page.

I found that my WHM PHP config screen let me change one param - upload size.

I changed from 2MB to 40MB, but Drupal only moved to 8MB.

The other turned out to be behind a little tiny "Advanced" option on the main PHJP config page.

Works lovely.

Ian Dickson

Hi. I'm using a free host (include Apache 2, PHP 5, MySQL 5).

I could not find php.ini file in my Drupal folder. I searched and http://forum.siteground.com/showthread.php?t=2144 told me to create a blank php.ini, I placed it in my Drupal root folder. I have set the value:

upload_max_filesize = 10M
post_max_size = 20M

First, it didn't work. In Upload module config page, I changed the "Default maximum file size per upload: " to
10MB and it showed me"
"Your PHP settings limit the maximum file size per upload to 1.46 MB.
Depending on your server environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory."

Then, I went to edit the .htaccess file. I put

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
...
php_value upload_max_filesize 10M
php_value post_max_size 20M
...
</IfModule>

I saved it and I changed the "Default maximum file size per upload: " to 10MB but it kept show me
"Your PHP settings limit the maximum file size per upload to 1.46 MB.
Depending on your server environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory."

How can I fix it? I'm still a newbie to Drupal.

I too am having the issue of not being able to upload files larger than 8MB. The error message is
An HTTP error 0 occurred.
/foldername/upload/js

I have created a php.ini file with:
upload_max_filesize = 128M
post_max_size = 512M

And I added the following to .htaccess
# PHP 5, Apache 1 and 2.
IfModule mod_php5.c
php_value yadda yadda yadda
php_value upload_max_filesize 128M
php_value post_max_size 512M
/IfModule
(greater than and less than symbols removed by me so the IfModule lines would appear in this message)

I still get the same results. This happened all of a sudden about 4 or five weeks ago. Everything up to that point was running fine. I made no changes, nor did my ISP.

John Munson, A+, Network+

This issue seems to be widespread. Are there any plans to fix this perhaps in a patch or new release? None of my users have been unable to use my site because of this, and everything that has been recommended has failed. I have even removed and re-installed Drupal.

Any input is appreciated.

John Munson, A+, Network+

I am affected by this issue like a lot of people. The problem resulting from the techs of your webhosting limiting the file size to upload via php. I have no problems uploading through other means, so it doesn't make a whole lot of sense as the admin of the site I'm operating. I can understand though why they may want to limit it.

My specific issue is in relation to the upload ability of the "FileField" component of the CCK drupal module, and therefore being able to insert into a content post a file playable with an mp3 player.

Now, if I had the option of instead choosing a URL where the file of my choice was hosted, such as the exact same place that files are uploaded anyway (such as "sites/default/files"), so that it wasn't uploaded at all through PHP and therefore wasn't subject to the limits of a server restriction.

I'd have no problems using an ftp client to upload all my files to that location and then using an alternative to "FileField" to simply specify which files in the folder I want to be displayed/accessible. It's not really an extra step since you have to do the upload anyway, and I already use an ftp client to upload drupal modules to try out. It's only a convenience to be able to upload a file via a content posting anyway.

I think I'll need to send off an email to the people maintaining the CCK module to create a component to add this functionality.

This article states that the maximum upload size is 50% of post_max_size but this issue and patch (http://drupal.org/node/104220) seems to have resolved that arbitrary limit. I've just sucessfully uploaded a 302MB file with a post_max_size of 384MB so it's must not be an issue anymore. Am I talking rubbish or do we need a correction?

...update, yes it was removed and I've corrected this page.

After trying all of these sugestions with no results, I finally renamed my newly created php.ini file to php5.ini and worked first time. This may be specific to my hosting provider "Patrick internet"

colinf

I also changed the "php.ini" filename to "php5.ini" and that fixed it!

Seems in Drupal 7, you need only modify (or create and modify) the php.ini file in Drupal's root directory. Modifying the .htaccess file just bugged out.

I have also had the above problem that my video upload field remained at 8 MB even though I changed it in Drupal.

I used the above help but as I am new to all this, I didn't know that changes to the PHP.ini file are not effective till

apache is restarted.

So I would just like to add this to this comment string.

Cheers, Karl

I also can't get past the 8mb limit. I've changed my php.ini file so both variables are set to 20MB. That raised the limit from 2MB up to 8MB, but I can't seem to get past the 8MB limit. does anyone know where this limit is coming from? I haven't seen anything in php.ini. settings.php or .htaccess

Using Drupal 7.0

Thanks a lot for any help,
-Josh

I figured this one out finally. The default php.ini that I got from my host included the line post_max_size = 8M I added the line post_max_size = 20M like the instructions say, but I didn't notice that there was already a declaration in there. So if you're having the 8MB problem, triple check your php.ini file for multiple post_max_size and upload_max_filesize entries.

I know that sounds trivial, but it fooled me for a really long time.

-Josh

whre is the default php.ini file located?

That fix worked for me, in my case default php.ini was in:

/etc/php5/apache2/php.ini

I changed the max upload size, but the limit stayed at 8MB until I did as suggested and searched for max post size, which was being set at 8MB.

Thank you so much Karl! That fixed it!

whre can i find php.ini file so dat i can change its values?

You can find a php.ini file in several places on the web. There is one available at: http://www.reallylinux.com/docs/php.ini

If you use that one,
post_max_size is on line 456
upload_max_filesize is on line 558

Hopefully "dat" helps :)

-Josh

If you aren't sure where the file is located you can tried the following command:

sudo find / -iname "php.ini"

In my environment I found three places where the php.ini files is located:

/etc/php5/cgi/php.ini
/etc/php5/cli/php.ini
/etc/php5/apache2/php.ini

I changed the one located in /etc/php5/apache2/ to increase the upload limit. It worked fine, no problems encountered, try it.

I have three web servers that run Drupal (2 development and one live) and I just ran into this issue. They're all Windows boxes and changing the php.ini file did nothing until I restarted IIS.

I know this is a simple thing but sometimes issues like this are simple to fix!

If the server is hosted or in accessible, this may present a challenge and obviously doesn't apply to Apache.

What is IIS?
How to restart it?

For the record, I'm running D6 and altering the php.ini files wasn't help, even thought it wasn't set anywhere else. Finally, in desperation, I added the settings to the .htaccess, and it worked fine. Not sure why, but hopefully it helps someone else

Upload a big file use FTP but via drupal - that`s my recommended.

Seemingly php.ini is set to allow 100MB uploads but Drupal 7 is telling me the maximum is 8MB.

How do I change the Drupal 7 value?

---
Paul Driver
Ilkley, West Yorkshire, UK

Go to your content type from structure, then Manage fields of your type "e.g. Product", then press on Edit, change the value Maximum upload size of this field to 100 .

I really hoped that would would, but alas not.

---
Paul Driver
Ilkley, West Yorkshire, UK

Hello,
unable to increase file size upload

I am using xampp localhost. I am unable to upload files more than 2Mb. I followed some instruction at drupal.org and changed my php.ini setting maximum allowed size for uploaded files. Upload_filesize = 8M, before it was 2M, and it worked in phpinfo() it stared to show me 8M but still I am facing the same problem. Durpal.7.4 shows file limit of 2Mb. In .htaccess were exactly we should enter these lines upload_max_filesize = 8M post_max_size = 8M,

Abhishek(SMS)

Thanks for this really helpful solution

After updating php.ini and .htaccess to 20M, I was still having trouble. I didn't realize that in the content type, I also had to update the figure there to 20 MB. Once that was done, it worked.

This worked great on hfase, I was having a problem with Drupal not noticing the changes to php.ini, I added the statement above to my .htaccess file and restarted the server and now everything works fine. Thanks for posting this! I have a lot of ram so I usually give it around 512M

If you are using Internet Information Server (IIS), also check that there isn't a requestLimit set in the web.config. Drupal will show that a larger size is allowed via php.ini, but large files won't upload.

Here is the setting to change, on my system it defaulted to 10mbs:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
...
    <security>
<requestFiltering>
            <requestLimits maxAllowedContentLength="10485760" />
        </requestFiltering>
    </security>
...
  </system.webServer>
</configuration>

Changed maxAllowedContentLength to 52428800 and 50mb uploads worked immediately.

brent

I need to download 2gb .m4v video file what do i do
the changes in web-config file to download.

One way to set upload size without changing php.ini file. If you donot have the access to the server to change php.ini file, upload size can be set through .htaccess file. By using these lines.

php_value upload_max_filesize 100M
php_value post_max_size 100M

It will set 100 MB maximum upload file size. I did it and it worked for me.

Ata.

I tried to add your lines of code in my .htaccess file in the root folder of my domain folder but when i did that all that happened was a i got a 500 error when I reloaded the page. So what did i do wrong?

Use above mentioned lines after following lines:

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

Note: Please remove '.' inside the tag after starting tag bracket '<'

i'm trying to increase the per file upload size on imce. i have increased it on the php.ini file, on settings.php and on .htaccess but it still is only showing 25MB and says that is dictated by my php settings. does anyone know how i can increase it significantly more? any ideas would be much appreciated. thanks!

there are imce settings in which profile are listed. Configure profile and set its maximum upload size to 0 or to let say 50 mb and then try.

I struggled with this for a few days so I thought I should comment on how I solved this:

When you run cron you get the status page which shows you your php version and gives you a "(more information)" link to the phpinfo page.
This shows you the exact path to the php.ini file in use under "Loaded configuration file".
This is important because there may be several version of php and php.ini scattered around your server.

So now when you:

  1. ssh with your admin user account and "sudo nano php.ini" and
  2. change the post_max_size and upload_max_filesize vars
  3. and reboot the apache server,

the changes will actually take place and show up in the phpinfo and in Drupal

So, after reading through all these comments, without any luck of my own, I decided to reinvestigate. I was confused because I changed the post_max_size and upload_max_filesize over and over, and added the overrides to the .htaccess file, all without any luck. My phpinfo() file continued to report back 8M and 2M (respectively) despite my numerous attempts to change it. Then I had the bright idea to see where the php.ini file was according to phpinfo(). Being on a mac, it reported back that the file PHP was using was located at private/etc/php.ini.
Then it all made sense: Running an iMac means my machine came with PHP installed (definitely a "Duh moment" for me), so there WAS another php.ini file lurking under the surface. Because it was in the "private" folder, none of my searches for the file returned the proper one.
SO! If you've made the changes in all the places you're supposed to have made them, and you're STILL stuck in the default settings, you may need to dig a little deeper.
Hope this saves someone some time and unnecessary aggravation.

For Drupal 7.

In my ServInt VPS I had to go to

/usr/local/lib/php.ini in the Drupal site directory and edit php.ini using nano php.ini

Then find and edit post_max_size

upload_max_filesize was already adequate.

settings.php did not need to be modified.

Is there a processing speed advantage to editing the php.ini vs the htaccess file, in terms of how fast the page will load? Or else is there a "higher failure-to-load-properly" rate for the htaccess method?

I want to maximize page-load speed (and avoid load errors), but I prefer the htaccess method if it works just as well.

Also, for the htaccess method, should the code go before or after 301 redirects? Or does it matter?

PS: I don't see why anyone would edit php.ini files if the htaccess will work equally well. Most of us have to edit the htaccess file anyway, and it is easy to find. Less risk of breakage, IMO.

"There are only 10 kinds of people: those who get binary, and those who don't."
braino

php.ini is a private config file.. if you put a generic, may go down your site...

Cristian Barreto
A/P
Punta Carretas Shopping

Using Acquia Dev stack ran into the same problem. Upload limit stuck at 8 MB whatever value I used in Drupal 7 or in php.ini file. Tried several computers. Then I realized that the default php.ini file has only one line related to upload size upload_max_filesize = 10M. The post limit line was not there, and also nowhere in other PHP version specific ini files. Adding this line post_max_size = 20M resolved the issue. Hope it helps.

Eugene K

Hi, I want to comment again that in many (perhaps all) host, just editing the php.ini will not change the settings, unless the web server is rebooted. This is because the web server only loads the php.ini on startup.

How to reboot your web server is going to be different depending on your host. In some cases editing your htaccess will trigger a reboot — you might even be able to open it, make no changes, save it, and trigger the reboot. On my host at MayFirst.org, using the member control panel to access the web server settings, click edit, and click submit without making changes, is enough to reboot the web server.

If you are making changes to your php.ini and nothing is happening, access your hosts help or FAQ system for how to reboot your server. Often this will be included at the end of any documentation on editing the php.ini. It varies by system, so you must do additional research.

An edit about this should be made to this page.