Howto: WordPress upload limit – increase maximum upload file size

WP upload limit – This is a tutorial on how to upload large images and files on WordPress and WordPress MU – increase the upload limit.

Here’s how to blow through the top 4 limits that you need to change before you can upload a large image file to WordPress for file uploads:

1) Php 3 Meg upload limit.

2) PHP interpreter code changes or modifications to get PHP to accept the large file size uploads.

3) Apache mime type not set right for file upload.

4) WordPress itself which has a default upload file size of 10Mb. This is for WordPress MU only.

Standard WordPress blogs at wordpress.com had 15MB and now 25MB limits (mid-2008), not including any images you use for your templates, those limits are just for you to store your images and files, 300KB for any individual file uploads (mid-2008).

The self hosted version of WordPress that you install is similar to WordPress MU, which is what I have experience with, if you have any doubts as to which of the 3 WordPresses I’m referring to, it’s self-hosted MU by default.

WordPress MU may look similar, but is a different animal altogether on the backend. You have much more control over every aspect of your wordpress blog with WordPress MU.

WordPress MU file size upload limit: from here on I am talking about WordPress MU, but the same applies to WordPress self-hosted.

If you are using MU, then you are storing your website on a host somewhere on the internet. This applies to your hosting account. If you don’t have direct control, it’s ok, just copy and paste these requests and email them to your webhost.

1) First limit is usually 3 Mb by default and is changed in the php.ini file at the host level.
Place this in your php.ini file in your root directory of your WordPress install (usually /public_html)
memory_limit = 32M
upload_max_filesize = 100M
upload_max_filesize = 100M
post_max_size = 100M

note: 100M is entirely too much for most use, this is to enable an upload of the largest file size possible through a web page!

Safer settings:

upload_max_filesize=5M and 20M
post_max_file_size=20M

2) I also had to do this to get the php interpretor to recognize the change and allow large files to be uploaded by adding this to the .htaccess file also in the root directory of my webserver for WordPress:
SetEnv PHPRC /home/yourusername/public_html

A temporary way to increase PHP’s memory is to add this to your PHP script, I prefer to set it above:
ini_set("memory_limit","12M");

3) Next limit was the fact that WordPress didn’t recognize the file type I wanted to upload, the upload was rejected with the message "file type does not meet security guidelines"

You need to add the file type association (windows terminology) as a “Mime Type” (linux server terminology) to the Apache server, or IIS if you’re doing windows hosting (let’s hope you’re not, linux beats windows hosting all day, every day, so far forever)

Find out what Mime Type you need to declare your new file as. ie. myfile.psd is a photoshop file, you probably know this, but your hosting server may not! Look up your file type here, w3schools is a great reference for all website code information, I use them all the time and consider them the authority on the subject of web code and standard ways of doing things.

To do this in WordPress MU use the Admin backend:
"Site Admin"->"Options"->"Upload File Types:" just type in the file extension of the type you want to add with a space separating each extension, no periods here!

I started doing this using pjw-mime-config WordPress Plugin, which will allow you to upload a file with tons of Mime Types already declared for you. WARNING! I found that it added as many listings for each Mime Type to a critical WordPress screen: Site Admin->Blogs->Edit->scroll down and you’ll see a setting for each mime type you’ve added, in my case I had more than 100! Do you want to crash your blog? After disabling PJW Mime types, I still have a super long Blog Edit Screen, it didn’t remove the data, each entry is non-editable for the respective extension (.tif, .psd, etc.) and says SERIALIZED DATA. I decided to use the standard WordPress way of doing it in the future, until I know how to undo this Plugin. Please post a comment if you know how. Update, you can remove mime types to the functions.php file in wp-includes directory at about line (1069).

4) This is for WordPress MU only. Next limit is not php, but WordPress itself which has a default upload file size of 10Mb, increase this in the Admin backend:
"Site Admin"->"Options"->Blog upload space" 1000MB is 1Gb
"Site Admin"->"Options"->Max upload file size:" 100000KB is 100Mb (this is the size of any individual file upload)

After doing this you should be able to upload anything up to 100 Mb for individual files and 1Gb for total storage for any user’s blog on the entire domain of your WordPress MU install.

After doing this you will likely run up against the limit of whatever hosting company you have your user account on, which is the account that WordPress is running on. Keep an eye out, it is either limited or you may get charged for extra storage space when your monthly hosting bill is due!

Update:
After making the changes above, I’ve been running some tests and running across a new limit. First my webhost says (and many do say this) there’s a 15Mb limit for PHP HTTP uploads. That’s 15 Megabyte limit for uploading files through a webpage to your server account not using FTP. Now I’ve got up to around 170 Mb through HTTP uploading and am hitting a different limit. First one is file types, large images are no problem, large audio files depend upon the format, even though the file types have been added to the server as Mime types. Same problem with alternate image types like .psd photoshop files, the error at the end of the WordPress upload right after “crunching”, is “File type does not meet security guidelines. Try another.” Renaming the same file to .jpg mitigates that problem, however I haven’t found an easy way to rename the file back to .psd using the HTTP upload interface (the upload webpage)

php ini files are simple and easy once you have your FTP connected. Have fun!

5 Comments

  1. Government Jobs in India says:

    Looking at this I believed it was very enlightening. I value you bothering and energy to put this article together. Again I find myself spending way too enough time both reading through and also writing comments. Although so what, ?t had been nevertheless worthwhile!

  2. bob says:

    it works. i love you

  3. Biju Subhash says:

    thank you …
    I have to check this out…

  4. Amy Pagnozzi says:

    This is a wonderful article you’ve written. And I know I’m commenting upon it a year too late but you seem to know of lots of workarounds and if you could figure out a way to disable the heinous crunching I (and a ton of other people) would be ever so grateful. The notion that those whose WP installations are self-hosted need WP to optimize their photos is absurd and as everyone knows, due to this crunching, photo uploads hang, constantly.
    Really, I can’t believe WP hasn’t fixed this by now, given the number of unhappy users. At this point, I would be more than happy to pay if I could turn off crunching forever.
    Anyhow, thanks, nice blog you’ve got.

    • GoogleThem says:

      Amy: Looks like you want to disable automatic image resizing in WordPress. As far as I know, crunching is resizing to the 3 sizes specified in Settings->Media->Image Sizes menu. Thumbnail, Medium and Large. So yeah, if you don’t want three images created for every one you upload, you can set these all to 0. If you make a note of what sizes you had them set to before you do this, it’s reversable.

      Now you will only have the original size available when you upload and insert into your post!

      I use “Full Size” often and believe that doesn’t suffer from any server side image processing, while leaving my thumbnail sizes intact. When you use excerpts I think it uses the thumbnail size.

Leave a comment