The default upload file size for WordPress is 2 MB, which is a problem if you want to upload a large media files. If you get this error, “The uploaded file exceeds the upload_max_filesize directive in php.ini”, follow these steps:
- Locate the php.ini file inside the wp-admin directory (if you can’t find this file see notes below)
- Find this line in the php.ini file “upload_max_filesize = 2M” and replace it with a higher value (e.g. “upload_max_filesize = 64M”)
- You may also want to increase your max post size. Look for this line in your php.ini file “post_max_size” and increase it as well.
- Save the changes to the file inside your wp-admin directory.
- Try the upload again
- If you still have issues, look for this file in your root directory and make the same changes.
If you don’t have a php.ini file in your directory, you can usually generate one from the control panels of your host. BlueHost has the steps listed to generate a php.ini file.
If you don’t have a php.ini file in your directory and aren’t sure where to get one (or want to see where I made the changes in the code), you can download my php.ini file. I have already increased the upload_max_filesize and the post_max_size to 64M. Once this file is copied into your wp-admin folder, the problem should be solved.
A Comment From a User
Someone left additional instructions below in the comments. I thought they were hilarious (and accurate) so I moved them up here:
@ Anyone who knows enough about their hosted files to be dangerous (ie: you crash and uncrash your site with the click of a mouse on a daily basis goofing with it), but need baby steps to do this, here goes…
First, copy the text from the developer’s PHP file listed above. (yeah, it’s long…copy all of it….no, don’t change anything. Heck, don’t even read his notes if you get intimidated easily. Really, it’s cool….just copy it as is…)
- Get into your files via however you do it on your host (FTP, CPanel, Legacy File Manager, whatever).
- Navigate to wp-admin folder. Scroll down to see if you have a php.ini file in there. I didn’t, and if you didn’t add one at some point, yours wont either.
- I have CPanel access, so in CPanel’s file manager, click on ‘new file’. Name it php.ini. Save it. Now, find it and check box the file name. click ‘edit’. scroll down through the ‘blah blah’ about encoding. leave the default encoding selection. click ‘edit’. a blank screen will open. right click in the box and paste the developer’s code. Click ‘save’. (if you use something else other than CPanel, adjust as necessary….for FTP, create this all in notepad on your ‘puter, name it php.ini and upload to the wp-admin folder via your fave FTP program….)
- Go to your wp admin panel. navigate to ‘media’. click ‘add’. voila, your new ‘limit’ will read ’64MB’. Upload something big and hold your breath. Voila….if your host doesn’t have some imposed limit, your file should be there ready to edit!
- IF you messed up somehow and your site breaks, don’t freak out. Just go remove the php.ini file (either by deleting it or by renaming it so it doesn’t get read). Chances are you didn’t ‘select all’ and paste it right. Start over by deleting the text from the php.ini file you just created. re-copy the developer’s text and paste it again. Give it another whirl…
I just upped the memory limit on the linked php.ini file to 64MB. One of my sites was getting the error: “allowed memory size of 33554432 bytes exhausted”.
hi,
i think it is not a good idea to change directly to php.ini file. rather we can use ini_set() function to set php.ini directive.
thanks,
tahsin hasan.
agree with @tahsin hasan
@tashin @Mr.Hyd
Didn’t get your point
Hello Devin,
I downloaded you PHP file and uploaded it to wp-admin but i’m still getting the same error when importing my posts. THanks!
Are you using BlueHost? You may also need to upload the php.ini file into the root directory of your site (see step 6). Let us know if it works after that.
Hi there,
I’m using justhost.com and uploaded your php.ini file into the wp-admin and public_html folders through cPanel (because I couldn’t locate one or create one through cPanel).
I attempted to upload a 15MB file – initially I was getting the ‘max size 8MB’ error. The upload got to 100% then went to the ‘crunching’ phase and stopped with an ‘HTTP error’.
Any ideas?
@Devin
I think you should not overlook some comments
I haven’t been able to use the ini_set() with any success on BlueHost. If anyone else has been able to have this work, please post your steps.
UPDATE:
I just contacted JustHost via their live chat and they told me that it is ‘Company Policy’ to only allow a max file upload limit of 10MB.
Damn, I guess I’m going to have to always use FTP to handle larger files.
I’m not sure how this is going to work with adding new media files to WordPress??
Hey Jeff. That’s too bad. Try using the WP Easy Uploader plug-in.
Thanks a lot man! This really helped instead of me creating an entire new php. i loaded it up into my wp-admin for a site i was working on and it didn’t give me any exceeded limit probs. kudos :)
I’ve been trying to upload a 25-MB pdf file to the media library of my blog: http://ricehoppers.net but to no avail. I am hosted by Justhost. How can I increase the media upload limit to be able to upload a large file like a 25-MB pdf file of a book.
Thanks for your help.
Did these instructions not work for you? If not, you should call your host and explain the issue.
This worked marvelously for my real estate website, hosted by 1and1.com, when uploading a 4mb file. Thanks for this post!
Thank you devin it’s very helpful for me…
Thanks for that php.ini file. It worked brilliantly for importing my WordPress data!
thanks that solved my issues. i had a php.ini files installed in my root directory but not in my wp-admin. it worked after i changed the file and also uploaded it to the wp-admin folder
Hi everybody,
I am with dreamhost and they did the same to me as well, even though I have a VPS with unlimited webspace, unlimited bandwidth per month and 1.5GB ram allocated to my account they wont allow me to change the php.ini file to suite. The only way to get access to the php.ini file is to use ssh access which I am not familiar with. I tried uploading your php.ini file into my wp_admin folder with no success, the limit is still set to 8MB even though I have changed the upload and post size limit to 150 MB, any help appreciated. I bet this question is definitely getting old over here with you guys.
hey! thanks for this post I finally solved my client’s problem. :) Thanks!
Devin. Thanks for the advice! :-) It really solves the problem.
I did call my host however they refuse to help me with this problem. thats why I am getting so anoyed with this matter right now.
Really? That’s terrible support for a VPS host. There’s plenty of other ones that will do a free migration if you want to switch. I’d just file a support ticket- and tell them you plan to change hosts if it can’t get resolved.
I told them if I dont get any help I will switch and they told me bye. Shocking support from what used to be a really good host in the past. Dreamhost has lost my bussiness.Yeah I have been so pissed off with this they forced me to move. Decided to go with Crucial Paradigm, they offered me full access to my php.ini file and best of all they are australian hosting so should go really well.
Hello
I am working local with wamp for the time being
I downloaded and used your php.ini file. Now when I load some large file to the meia library i get a different error message, that says that my file could not be saved in the directory, and actually it is not in the usual directory..
May you help ? Thanks
I don’t work with wamp, so I’m not really sure. Did you try googling “wamp wordpress upload limit”?
I actualkly found a script that fixed everything for me. Verry happy now. was easy,
maybe you could tell us more about this script Nick ?
I found one to to be written in the ht access file, works fine in local, but did not work with a french hoster called 1&1
this is the script to be written anywhere in the ht acess file :
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200
And to devin : no I did not tickle wamp, I’ll be on line shortly, so I need to find a solution that will be okay outside of wamp..
I’m on MediaTemple (essentially Dreamhost) and so far, the htaccess file script above seems to be the only thing that is working…
Thanks for this…
I’m on Media Temple as well and they do it in a whole different way. If you are on the Grid-Server then follow the following instructions. You need to edit the MASTER “php.ini” file through your admin.
http://kb.mediatemple.net/questions/137/How+can+I+edit+php.ini+file%3F#overview
*NOTE: but wait there is more! I tried the methode mentioned above and nothing changed. Then I added the following lines
memory_limit = 80M
upload_max_filesize = 80M
post_max_size = 80M
file_uploads = On
Saved the ini file and the upload works beautifully on the Parent and all sub domains.
Ok Guys,
tfor those on dreamhosts servers here is the hack to be able to access a php.ini file and modify the settings. http://sxi.sabrextreme.com/phpini
* Download the script from the link in here.
* Install the script by going to the script URL
The patch basically installs a php.ini file in the cgi-bin folder of your hosting.
* To Edit your php.ini file simply download the php.ini file that was created in the cgi-bin folder to your computer.
*Edit the file through notepad.
*Look for the Maximum file size upload limit, max Post size and also dont forget to set the resources limit higher (RAM) to desired level.
* Overwrite the file with your modified version. Reboot your server through your web hosting panel and you are done.
I have successfully increased my file size and post size limit to 150MB. I have set the ram allocated to wordpress up to 1500 MB as provided for by my VPS. The website runs alot better too now, much quickewr as the ram level was increased from a pissy 8MB to 1.5GB.
Good Idea to create an unmodified backup file of the php.ini file just ncase you screw things up.
I hope my words of wisdom have helped guys. They didnt come easilly. And dont bother contacting dreamhost about help in doing this as they rudely and blatently refuse to do so. Their product is excdelent however the support services are in need of a serious restructure if they want to go into the mainstream market.
Hope this helps guys, here is my URL http://www.showoffyoruwheels.com.au
Hi,
I am using wamp and i installed wordtube. I am new to using wordpress and i havent started hosting yet. i am just building a site in my localserver. when i tried to upload a .mp3 file i got ERROR : Upload failed. Check the file size. So i googled and landed in your page . I downloaded your php.ini file and saved it in my wp-admin folder. but stil i am getting the same error. i am unable to upload and it gives ERROR : Upload failed. Check the file size. Any solutions and suggestions welcome ASAP :)
Thanks a lot!!!! It really works for me..Now I am able to upload any size of file on my server using wordpress.
Thanks
Rohan
hi rohan
can you please temme how it worked?? coz i ve been trying, posted a comment here too but still no responses and solutions :(
Regards,
Arul
Hello
I am back just to tell those who have problem that I have been working on 2 different hosts subsequelntly : with the first one, what did the trick was the php.ini file in the wp-admin folder.
And with the second host, it doesn’t care about the php.ini, but the changes in the ht access file worked.
So well, try both methods…
Thanks Devin. Your solution works perfectly. Why WordPress does not explain this situation in the Docs?
@ merlot: agreed!!
@ developer: THANK YOU. worked perfectly.
@ anyone who knows enough about their hosted files to be dangerous (ie: can crash and uncrash your site with the click of a mouse on a daily basis goofing with it), but needs baby steps to do this: Here goes… First, copy the text from the developer’s PHP file listed above. (yeah, it’s long…copy all of it….no, don’t change anything. Heck, don’t even read his notes if you get intimidated easily. Really, it’s cool….just copy it as is…)
1. get into your files via however you do it on your host (FTP, CPanel, Legacy File Manager, whatever).
2. Navigate to wp-admin folder. Scroll down to see if you have a php.ini file in there. I didn’t, and if you didn’t add one at some point, yours wont either.
3. I have CPanel access, so in CPanel’s file manager, click on ‘new file’. Name it php.ini. Save it. Now, find it and check box the file name. click ‘edit’. scroll down through the ‘blah blah’ about encoding. leave the default encoding selection. click ‘edit’. a blank screen will open. right click in the box and paste the developer’s code. Click ‘save’. (if you use something else other than CPanel, adjust as necessary….for FTP, create this all in notepad on your ‘puter, name it php.ini and upload to the wp-admin folder via your fave FTP program….)
4. go to your wp admin panel. navigate to ‘media’. click ‘add’. voila, your new ‘limit’ will read ’64MB’. Upload something big and hold your breath. Voila….if your host doesn’t have some imposed limit, your file should be there ready to edit!
5. IF you messed up somehow and your site breaks, don’t freak out. Just go remove the php.ini file (either by deleting it or by renaming it so it doesn’t get read). Chances are you didn’t ‘select all’ and paste it right. Start over by deleting the text from the php.ini file you just created. re-copy the developer’s text and paste it again. Give it another whirl…
PS: I use GreenGeeks hosting.
PSS: If you have no clue how to access your files on your server you’ll need to befriend a minor geek to complete this fix as you can’t just click a button in your WP admin panel and get it done. You must go play with the files :-)
Hey CJ, your comment cracked me up! I also thought it was spot on, so I moved it up into into the body of the post.
Thanks! I have been searching for a 1and1 wordpress max upload limit solution and this worked perfectly, even on latest wordpress 3.0.3
Thanks! Your script worked like a charm!
Thank you. I’m not a techie by any means and it worked first time (I am on Blue Host so that helped give me confidence). The previous 10MB limit is now 64MB…perfect. Thank you again
Help Please!
I added the php.ini file to my wp-admin but it does not change.
I am using wp network setup, know before as MU and my hosting is with hostagtor.
I am wanting to upload a video file that is over 50mb but for some reason it is not working.
Is there something different that I need to do n/c of it being WP network?
Thanks
Corina
I’ve been trying to figure out how to get around this problemfor a for a while. The fix(copy the php.ini ) worked perfectly. Went from 8M to 64M.
1&1 hosting.
Thank you very much!
I’m running WAMP, and editing the php.ini file in the wamp menu partially worked, raising the level to 8M.
The block is a php.ini file in the Apache folder, where you need to set post_max_size and upload_max_filesize, then restart the server.
If you only set one of them, WP will pick the lower limit.
Thank you so much for this fix- my shoulders have just relaxed!!!
Everyones gotten such great results, im sad it didnt work for me.
I uploaded your php.ini file to wp-admin and see no change in the media upload file size.
any ideas why this would fail on a regular wp install?
I also tried the htaccess and got a 500 internal server error on the site, so I probably did that wrong.
any ideas?
If you changed the php.ini file max file size and max post size all you need to do to get it working in to reboot your server for it to work and beleive me when I tell you it works it works. If you dont reboot your server it wont read from the file. Think abut it, ini extension is an abreiviation of the word initialize which means it is only read when the servewr is rebooted and kept in cache. Siply uploading the php,ini file wont allways work because the server may not be configued to look for a php.ini file during start up so if you read a bit more of my previous threads it desribes downloading a script to your ftp folder, opening the url and following the destructions. Then you will have a php.ini file you can modify that when you alter after a reboot will work for you.
i believe rebooting the server is something id have to ask my host to do, since Im on a shared hosting account. any way around that? Ive tried everything to get this to work, htaccess, editing the wp-config file, editing the functions file and this php.ini override, each a bunch of different ways. Nothing works. Im at the point where Im thinking id have to move my site to a different hosting server to get this to work.
Try calling your host. This should be something they can help you out with and walk you through. If they’re not willing to help, then, I’d say yes, maybe it’s time to switch hosts.
And also try #6. Upload the php.ini file to your root directory as well.
I tried uploading the file to both the root directory and wp-admin. no luck. My host told me that their php default upload is 2Gb, looking in php info, it says 2mb. So youre right about that switch.
Great tutorial though. I really love this blog. I made a killer theme with your options framework. Great Stuff! It all works wonderfully, you’re a good teacher!
Devin and CJ–thank you thank you! I’m not tech savvy by any means, and your instructions for working with WP and Bluehost worked perfectly after I restarted my browser.
I have a video that’s over 45 mins and over 1 GB in size; is it ok to increase the max upload size to be 1.5 GB? Wanted to ask before I caused any major errors.
Hey Devin and CJ, thank you very much for this helpful posting. Worked like a charm!
I have put the php.ini file in wp-admin on FTP and then I go back to the website and I can’t access the Dashboard!? It’s just white space?? Any ideas??
I was having this issue as well, I troubleshooted for hours, in addition to updating the php.ini file , you also need to make some changes in GUI, I’ve listed the steps below, which I found from this post : http://wordpress.org/support/topic/changing-file-upload-limits
Get to the Network Admin page. In WordPress 3.1 this link is found on the top right of the admin screens. It toggles between Site admin and network admin.
Click on “Settings” in the admin panel on the left hand side of the screen.
Near the bottom of this page is a section called “Upload Settings”. Find it.
There is a field for “Max Upload File Size”. The units are KB.
Convert your intended file size into KB. (100MB = 100 * 1024 * 1024KB = 104857600KB)
save changes at the bottom and test for sanity.
when changing the two parameters in the php.ini file it will be necessary to restart you http server (service httpd restart on redhat, centos, FC) in order for it to pick up these two changes in php.ini. I have read several posts where people state that these changes did not correct the problem. I too ran into this but when I restarted my httpd server I could upload the larger file size. Hope this helps.
Hi Devin.
Just wanted to thank you for the post. It works very, very well!
Fred
Thanks.
It work very well !
Thank You. Thank You. Thank You.
Hey guy, very very thanks.
My machine windows 2008. php.ini in “windows” and “plesk/php5” directory. Limit 30MB thenks…
[…] As I was going over the email folder that is called “Soon”, I realized there was a request from Debra to increase the Maximum upload file size in the WP admin are, specifically on the media library, then I realized that this is in deed possible on the servers we are hosting, not by updating the php.ini (as that is not allowed there), but by adding two lines of code to the .htaccess on the wp-admin folder as explained here: […]
For reference, this no longer works on a more up-to-date install.
Can anyone else verify this? Matt, did you find a different solution?
Yes, all the newer installs have it at 64mb.
Verified that this no longer works on newer WordPress installations. Tested it on 3.2.1 without success. :(
This worked for me… thanks!
This has just fixed problems for me also.
Had migrated 4 sites to Hostzilla and trying to update one of them realised the 2M upload problem.
As a matter of interest I did setup another subdomain using latest WP 3.3.1 which gave same 2M problem.
Just copied the php.ini files on each domain inti wp-admin – FIXED.
A big thanks for this fix which took 2 days to get to but was worth the find
In a wordpress multi site installation you ‘ll have to change manually some values in site_meta table :
They are:
1. blog_upload_space – The amount of space a single blog has to upload files to
2. fileupload_maxk – The largest file that may be uploaded (I believe this is in bytes)
3. upload_filetypes – This restricts the MIME type that can be uploaded I believe through the Flash uploader
http://seanklein.org/2009/06/wordpress-php-upload-information/
You’re absolutely right. php.ini alone won’t increase it. You have to change the “fileupload_maxk” value.
mysql> select * from wp_sitemeta where meta_key = ‘fileupload_maxk’;
+———+———+—————–+————+
| meta_id | site_id | meta_key | meta_value |
+———+———+—————–+————+
| 7 | 1 | fileupload_maxk | 1500 |
+———+———+—————–+————+
mysql> update wp_sitemeta set meta_value = ‘15000’ where meta_key = ‘fileupload_maxk’;
I am using a wordpress multi site. The instruction for .htaccess did not work, that for php.ini equally but soon as i changed the value from 1500 to 15000 in wp_sitemeta set meta_value of mysql it worked. This can be located in phpmyadmin on your cpanel. Thanks a lot
Thanks that worked for me. I had uploaded your php.ini file and now I can upload 1000 MB files :)
(bow)
I found nothing in this article to be true. There’s no PHP.INI file, using yours still does not work.
Uploading a simple *.wmv to be displayed on a simple WP theme has turned a 10 minute job into a two and a half hour job. “.htaccess” file manipulation is also a waste of my time.
I’ll try the Memory Bump thing, but I have my doubts.
Moving right along…
May not work with all hosts. Good luck.
If you are on wordpress multisite It won’t have effect till you made the changes I described earlier on the database. But devin is true it could just depend of your host.
Good luck