Wordpress Amateur Hour: enabling large file uploads with upload_max_filesize
This was a minor odyssey – I’m trying to import a Wordpress Export/XML file to this blog, yet the file size of 2.8MB exceeds the built-in limit of 2MB. Apparently this was included as a bandwidth hedge for hosters of some kind.
Judging by the amount of Google hits on “upload_max_filesize wordpress” it’s apparent this isn’t a simple fix.
In any case, the answers start with “Change your php.ini file” followed with “if that doesn’t work, change your .htaccess file”. The latter is often suggested as some hosters don’t allow you to edit php.ini. Mine (BlueHost) does, as confirmed via a quick live support chat tonight.
So great, I can edit php.ini – and I need to change this line:
upload_max_filesize = 2M
to
upload_max_filesize = 10M
or whatever your desired max upload file size is. “M” = Megs. You also need to add, right below the above, on its own line:
post_max_size = 20M
Again, edit the # to whatever you need, though it apparently needs to be larger than the upload_max_filesize #.
But I have several php.ini files, and none seem to make the change work!
Ah, so the clincher in a Wordpress install, for me at least – WHICH php.ini file needs to be edited? You may have several -> at your www root, inside your WP install, etc. In my quest, it turns out NONE worked – but the help text from my hoster included in the php.ini file (any of them – all were the same) noted that I needed to copy over a php.ini file into whatever folder held my upload script, aka “upload.php”.
In Wordpress, that means wp-admin folder. So the solution, in short:
- Confirm you can in fact access/edit your php.ini files. Assuming yes (if no, go see this article referencing the .htaccess bit), then
- Copy/duplicate the php.ini file that sits in your Wordpress install’s root folder.
- Move the copy to wp-admin
- Rename it back to php.ini
- Add in the above code
- Save
No guarantees whatsoever, but it worked for me! If you are all all nervous about playing with some of your core Wordpress or hoster files, I’d probably hop over to your hoster’s support forums first.















35 Comments
[...] can read the rest of this blog post by going to the original source, here [...]
You, sir, have saved my bacon from the wrath of my Irish priest with this advice! (Okay, I’m kidding about wrath…kinda. Heh.) I’m moving our parish website over to WordPress forced into a static page kinda configuration, and it seemed like there was no way on this Earth that I was going to be able to HTTP our audio sermons to the site. It never occurred to me that upload.php was the active file in all of this for some reason.
All of this to say that you rawk and I get to make Father happy. The world is well. Thanks so much!! :-)
@Infinitely – haha, glad I could help. :) That’s why I wrote this, as I figured if it took me 10 hours or so of painful hunting online, others must be in the same boat.
Great!. It worked for me too. I copied php.ini file to wordpress admin folder and problem solved.
Thank you Kevin.
Thanks! it really did the magic!
@AeonMusic This is what i did: http://tinyurl.com/5ua5lr
I can’t believe… it’s works really fine !!! php.ini has been copied to the WP-ADMIN and it works fine !!!
what a stupid bug !!!
this is what i do after getting advice from my webhosting..
create php.ini file. In it, put this :-
[PHP]
upload_max_filesize = 9M
max_post_size = 9M
then upload this file to wp-admin. Its working fine with me…
Thank you so much.
My root PHP ini file (on BlueHost) was named “php.ini.default,” so I downloaded to my desktop changed the settings to “upload_max_filesize = 100M” and “max_post_size = 100M” and then renamed the file “php.ini” and uploaded to the WP admin folder and it works great!
THANK YOU!
Thank you so much. The Bluehost comment from Renee above worked perfectly for me too. The key was renaming the file to php.ini and putting it in the wp_admin directory.
Thanks so much for the help!!!
Thanks great but i couldnt find the file, eventually got it:
Can’t find the php.ini file on your server ?
this will help blue host users find the file.
http://helpdesk.bluehost.com/kb/index.php?mod_id=2&id=145&kb_rating=yes
This was very helpful. I was trying to upload a video to my site, and once I found out that the php.ini file needed to be in my wp-admin folder, my video uploaded fine. Unfortunately, even though I can now upload my video, for some reason Wordpress won’t display the video in my post. I can get it to display a link to the video, it won’t embed the video in my post. Any suggestions?
Thanks,
Yes! The /wp-admin folder, that’s the ticket. I can’t believe that this tip is not easier to find. I don’t doubt you spending 10 hours hunting for the solution. Came to your post through this thread on the Wordpress support forum after a good while myself: http://wordpress.org/support/topic/165450 . Thanks for your detective work!
Ross, Lance, Daphne, Marc, etc – glad this post helped!
@Lance – I’m certainly not an expert, but I think the issue is you are just trying to link to a file (the video) you uploaded, instead of to a stream of that video like you’ll find on YouTube. To get it to stream, I’m sure there are ways to DIY, but I would probably just go get an account on Vimeo (my favorite) or YouTube, upload the vid, and then just embed back to your blog post.
Kevin,
As an Oregon State Grad it is difficult for me to say this, but here it goes . . . .
“There is at least one Oregon grad that contributes to the world.” Thanks man, you saved me hours. I appreciate it tremendously.
John
[...] forum detective work before I came across this helpful thread, which subsequently led me to this clarifying post that told me to put the custom php.ini in the /wp-admin [...]
dude you saved me, i’ve been trying to get this thing working, but somehow i didn’t know i have to paste that into my admin root as well.
cheers.
Does one have to rename it in the root directory as well?
What I mean is does one have to rename the original php file as well? Sorry, all the technicalities are a bit beyond me
Hi ra:
Yes, the file has to be named “php.ini” and live in your blog’s root directory. Keep in mind I haven’t tried this again since I wrote this post 9 months ago, so things may have changed. But back then, yes, the file in your root had to be named php.ini.
Hope that helps!
Kevin
[...] Tonight as I was searching for a replacement I came across WP Audio Gallery Playlist. It is a little different than the old one but so far it looks like it should work fine. The main difference between it and the old one is that now I upload my mp3’s to each individual post, instead of having one folder on the server that holds them all. That’s no big deal, but this is where I ran into my first little problem. It seems that my php.ini file’s max_upload_filesize was set to the default of 2MB. Most of my mp3 files are larger than that, so I kept getting “File Too Big” error messages when I tried to upload them to a post. I Googled my problem and a few minutes later I came across a solution on Kevin Briody’s blog. [...]
THANK YOU!!! I was about to go insane after hours of hunting and tweaking without effect. This did, thanks so much.
OK, I’m having a problem. I set my upload_max_filesize to 20M (was 2M) and added a value for max_post_size = 20 M.
I renamed the file php.ini and put it in my public_html folder, and also in the wp-admin folder of this particular install of Wordpress.
In the Wordpress dashboard, I go to “Upload New Media” and submit a file. It says, “The file is too big. Your php.ini upload_max_filesize is 20M”. The file is not even 9 megabytes.
What am I doing wrong?
thank u!!!!!!!!! now I can upoload my videos to my space in bluehost!!!!
I had the hardest time getting mine to work. I edited the php.ini file what seemed like a thousand times and it did not work. I finally named it php5.ini (since I have a godaddy host on php5) and it magically worked! THanks!
Copy what cyber6 wrote. Paste into word pad. change file and post size values to what you want. Save as php.ini Upload to root directory, and voila! It works! Thanks a bunch, I’m done and haven’t even gotten a response to my ticket yet…
Thanks alot..this saved me!
Thanks buddy!! It worked.
Most excellent advice. I had run into this problem months ago, figured it out (somehow!), and promptly forgot to write it down and — most importantly — how to do it.
Your post saved me HOURS, literally (that’s how long it took last time). Thank you very much!
thanks. it was picking up the changes in /etc/php.ini but refusing to let me upload the file until I copied php.ini to wordpress/wp-admin
Thanks for the simple explanation. Uploading a php.ini file to the wp-admin folder with upload_max_filesize did the trick. Much clearer than every other explanation!
Hey Kevin, thanks SO MUCH for the info. This worked just as described. Karmic kudos to you, my friend! -G.
Copying the edited php.ini file into the wp-admin folder did the trick. Thanks!
Super! Did exactly what I needed!
Thanx from Germany!
Edward
MUAHAHAHA It actually works! Took the php.ini.default , edited the
upload_max_filesize = 10M
max_post_size = 10M
Renamed it to php.ini and uploaded to wp-admin and it works!