Increase media upload limit – WordPress tutorial

Posted on Monday 24th Oct 2011 by Dan 1 Comment

Today I wanted to share a little trick to bump up the memory limit of your media uploader in WordPress. It’s pretty much only once in a blue moon that you would need to do this, but when that time comes – here is how you achieve the end result.

I probably wouldn’t recommend doing this unless you really have to. The last thing you want is to be uploading 100′s of MB’s into WordPress. If you want to be using this size of file on your website, then you should probably be using an FTP client (I always find Filezilla to be the best) or if it’s something like a video then maybe it should be embedded from Youtube for example.

The way to do this is through the .htaccess file on your website. Don’t underestimate the .htaccess file. Although it is a tiny file compared to the rest of your web design, it can be very useful.

How to…

So let’s get into how we are going to do this. Our control is going to be in our website’s .htaccess file as previously mentioned. There’s 4 lines of code you want to use in the page and they are as follows:

php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 5000
php_value max_input_time 5000

So the first part of each line is the function and the second part is the limit size.

Our first line is used to increase the max filesize that you can upload. This is set to 20MB but by changing that number you can change the filesize limit.
The second line is to increase the limit of the maximum post size. If you are going to be embedding huge files into the post, then you will need to bump this limit up as well.
The third and fourth line are very important. This is do with the time limit that is given to WordPress to process these files. If the limit here isn’t big enough, then when you upload a big file, WordPress won’t process the file in time. The number here is represented in seconds.

So all you need to do is paste them 4 lines in to your .htaccess file, configure as necessary, upload and your away!

I hope this can be of some use to you in the future, any questions or comments please leave below.

About Dan

Dan is a huge Wordpress fan. He enjoys creating hectic PHP functions and playing football amongst other things.

See all of posts.

Add on Dan Google+

Dan's Tweet's

  • RT @BBCMOTD: big, Big, BIG Match of the Day this Sunday. The title, relegation and European qualification all sorted. 10 matches, one show. 10.25. BBC1. 5 days ago.
  • Tearing the web a new one w/ @kent_robert #55B05A 5 days ago.
This entry was posted in Tips For Web Designers, Wordpress Tutorials and tagged , , . Bookmark the permalink.

One Response to Increase media upload limit – WordPress tutorial

  1. Henk says:
    February 29, 2012 at 6:35 pm

    Thank you, I was searching the net for a soluting to bypass the 2 MB upload limit and found your page.
    The only thing I don’t see at your page is the location of the .htaccess file, the mine was missing at the root of WP. After creation all works fine
    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>