Wordpress Amateur Hour: enabling large file uploads with upload_max_filesize

July 5, 2008

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:

  1. Confirm you can in fact access/edit your php.ini files. Assuming yes (if no, go see this article referencing the .htaccess bit), then
  2. Copy/duplicate the php.ini file that sits in your Wordpress install’s root folder.
  3. Move the copy to wp-admin
  4. Rename it back to php.ini
  5. Add in the above code
  6. 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.

  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Tumblr
  • TwitThis

{ 3 trackbacks }

» Wordpress Amateur Hour: enabling large file uploads with …
July 6, 2008 at 5:06 am
Wordpress Upload Blues: php.ini upload_max_filesize is 2M | Folks Pants: Tailor Made Internet
February 8, 2009 at 2:34 pm
RAMBLE ON » Testing The Tunes
March 27, 2009 at 6:55 am

{ 25 comments… read them below or add one }

Infinitely Overjoyed August 11, 2008 at 7:58 pm

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!! :-)

Kevin August 11, 2008 at 9:36 pm

@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.

KODIWEERA August 12, 2008 at 10:03 am

Great!. It worked for me too. I copied php.ini file to wordpress admin folder and problem solved.
Thank you Kevin.

ilovecolors August 24, 2008 at 4:42 pm

Thanks! it really did the magic!

Kalvin October 1, 2008 at 7:24 am

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 !!!

cybersix October 20, 2008 at 3:44 pm

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…

Renee December 30, 2008 at 8:41 pm

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!

Marc January 5, 2009 at 4:06 pm

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!!!

daphna January 13, 2009 at 2:32 pm

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

Lance Bledsoe January 17, 2009 at 4:19 pm

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,

ross chapman January 30, 2009 at 2:18 pm

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!

Kevin January 30, 2009 at 3:18 pm

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.

John February 4, 2009 at 9:51 pm

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

Ali March 2, 2009 at 11:46 pm

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.

ra March 19, 2009 at 8:25 am

Does one have to rename it in the root directory as well?

ra March 19, 2009 at 8:26 am

What I mean is does one have to rename the original php file as well? Sorry, all the technicalities are a bit beyond me

Kevin March 19, 2009 at 9:32 am

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

Amy April 5, 2009 at 1:33 pm

THANK YOU!!! I was about to go insane after hours of hunting and tweaking without effect. This did, thanks so much.

Matt April 30, 2009 at 5:21 am

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?

beatriz May 5, 2009 at 5:39 am

thank u!!!!!!!!! now I can upoload my videos to my space in bluehost!!!!

drew May 5, 2009 at 12:48 pm

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!

Scott May 21, 2009 at 12:40 pm

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…

LEO June 15, 2009 at 12:37 pm

Thanks alot..this saved me!

Jason Wagner June 16, 2009 at 11:32 am

Thanks buddy!! It worked.

Leave a Comment

Previous post: News of the Strange: Duckfest 2008

Next post: Meta is the new crack