How to change the PHP Upload Limit

by Jay Versluis

in .htaccess,PHP

Usually your hosting package limits the amout of data you can upload to 2MB, which isn’t enough for most of us. It’s good for that 200k photo, but say you’re uploading a 4MB audio clip, a video or a large PDF, you’re stuck.

Fret not my friends, for help is at hand! Put the following code in your .htaccess file and smoke it:

php_value upload_max_filesize 100M
php_value post_max_size 100M

Instead of “100M” you can choose any limit you like, say 5M, 10M or whatever limit you like.

If you can’t find the .htaccess file, it might either be that

  • your FTP client doesn’t display hidden files; make sure that it does
  • or it doesn’t exist (in which case, create a plain text file, upload it and name it .htaccess)

{ 3 comments… read them below or add one }

Jimmy Cracked Corn July 13, 2009 at 9:15 pm

Thank you. This worked great for me today on a WP install on a Mosso/Rackspace account.

Reply

Tom S August 23, 2010 at 5:40 pm

Doesn't work for me. If I insert those lines in the dot-htaccess file, WP doesn't work at all (gives me a Bad Configuration Error). Any ideas?

Inside the dot-htaccess file are these lines already. I put your code at the bottom (under the last # END Wordpress comment):

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Reply

Jay Versluis August 24, 2010 at 8:22 pm

Hi Tom,

sorry to hear that. I\’d put the php_value statements at the very top of that file.

The current contents makes it possible for Wordpress to use \”pretty permalinks\”. If all else fails, delete everything in the .htaccss file, make the file writeable and add the php_value statements I\’ve given you. Then go back to Settings – Permalinks in Wordpress to update the rewrite structure.

Good luck ;-)

Reply

Leave a Comment

Next post: