How To Upload Media Files Over 2 MB in WordPress

So you want to upload a very high resolution picture, or a sound file or a video, and wordpress keeps telling you your upload is too large. It won’t take it. Or maybe WordPress seems to be uploading it, but when it gets to the end you see a message that the file was too large and could not be uploaded.

This is a common, two part problem to run into in WordPress. It is caused: 1. By Your WordPress Settings, and 2. By Your Web Host Settings.

First we’ll tackle your WordPress setting. Most likely your installation of WordPress has defaulted to a maximum upload size of 2 Mb. This is great for the quote-unquote typical user who may or may not exist in the real world. But it’s 2012 (or later) and you have serious content you want to put up. It’s not like it takes an hour to download 100 megs anymore. But WordPress is doing you a favor here, because for most of us uploading is still pretty slow and who wants to upload a big ass file and not see that it failed until the very end? Still, we need to override this.

You can put this in wp-config.php:

{code type=php}
/** Increase maximum file upload size */
define(‘WP_MEMORY_LIMIT’, ’64M’);

but that could fail because your theme might override this. Instead, put this in your functions.php file:

{code type=php}
/** Allow larger file size uploads **/
function max_up_size() {
return 10000*1024; // 10000 k bytes  aka 10MB
add_filter(‘upload_size_limit’, ‘max_up_size’);

You can change the upload size to whatever you want. Just keep in mind there are legitimate security reasons for limiting your file size. You don’t want some black hat hacker to use your website to share pirated software or video across the world, do you? You should keep this number down to something just over what your typical needs are. Remember, you can always change it later if the need arises.

Now WordPress thinks you can upload up to 10 MB without a problem. But most servers default to 2MB and we are going to have to fix that.

Now for Step 2 – The Server

If you have control of your server’s php.ini file this step is easy. Open it up, search for upload_max_filesize and change the line to this:

; Maximum allowed size for uploaded files.
upload_max_filesize = 10M

But if you don’t you can try changing this setting with your .htaccess file. Go to the root of your WordPress installation and open up .htaccess in your favorite text editor. Add this:

{code type=perl}

php_value upload_max_filesize 10M
php_value post_max_size 10M
php_value max_execution_time 500
php_value max_input_time 500


And that’s it. I can’t guarantee it will work for you because your web server might be set to disallow .htaccess. If that’s your situation, you’re going to have to contact your hosting company.

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=""> <s> <strike> <strong>