WordPress Media upload HTTP Error

WordPress and WordPress-MU have given me the HTTP error in the various installations I have performed and each time there’s a different cause. This post is nothing more than a personal notation for future reference but I hope it’s helpful to someone.

Error: when trying to upload media using the WordPress Flash uploader it get the message HTTP Error

Disclaimer: before messing with your .htaccess file, make sure you have a backup copy of it in case it causes a 500 Server configuration error. If this happens just replace the .htaccess file with the back up version. Check your code for any mistakes and try again.

Possible causes:

  • mod_security – basically all Apache servers will have it turned on, so you may need to turn it off for the async-upload.php file using .htaccess. The newer versions of WP have added this code already, but in case you mess up your htaccess file, here it is.  Just add the following lines to the bottom of your .htaccess file in the root folder of your WP or WP-MU installation. 
<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>

  • Access Denied Error 403/ Permission issue – another typical problem. Make sure that the upload folder is writeable by the server, you can set the permission to 754 and it should work fine. In WordPress the upload folder sits under /wp-content/  in WP-MU it sits under /blogs.dir/”blog number”/files  (default site blog number is 1 and the other blogs are numbered in ascending order of creation)
  • PHP Upload limit – check you PHP.ini settings for the settings upload_max_filesize and post_max_size. You can change these directly in your PHP.ini if you have access to it or you can change it by adding a php.ini file to you root directory with the following code. The default is normally 2M but you can change it to anything at your own risk, you should not need more then 8M.)
post_max_size = 8M
upload_max_filesize = 8M

or by adding the following lines to your .htaccess file:
php_value upload_max_filesize 8M
php_value post_max_size 8M

for anything above 8M you may need to add an execution time to the .htaccess code also
php_value max_execution_time 800

  • Authentication Failed Error 401– I checked my server log and noticed that WordPress was trying to access the 401.shtml error template every time I got the HTTP error during a media upload attempt. This normally occours if you are using password protection for the WordPress root folder or the folder where your uploads should reside. You should disable the password protection on the folder i norder for the uploader to work.

Hope it helps. Please leave your contributions and bug reports so others can benefit from it.

Technorati Tags: , , , , , ,

  1. Wordpress Media upload HTTP Error · WP Air - pingback on August 26, 2009 at 2:10 pm
  2. Thanks for this! After going through all of these, I also figured out that you need to be sure to up the max upload rate in the site configuration. Mine seemed to default to 300KB.

  3. PHP post_max_size upload_max_filesize | KnowledgeBse - pingback on October 22, 2011 at 6:58 pm

Leave a Comment


NOTE - You can 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>

 

Trackbacks and Pingbacks: