30 March 2008 @ 18:55Fix WordPress upload error – HTTP error

The inability to upload files in WordPress first showed up in version 2.5. The solution for me was to edit the .htaccess file in the root directory of my webserver (the directory where WordPress is installed). Add the following to the the .htaccess file after the “END WordPress”:

<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off

If you are having the problem of your .htaccess file losing its changes, you have most likely put something inside the WordPress block of the .htaccess file. Keep any custom changes outside of that block or they will be overwritten.

It seems that this problem still occurs in WordPress 2.6, but the error message is slightly different — “An error occurred in the upload. Please try again later.”

This fix is still necessary in newer versions of WordPress.

Be Sociable, Share!

by | 42 comments | Tags: , , , , ,
Posted in bugs, wordpress | Link to this


  1. Kappacelu` | 01 Apr 2008 @ 16:12 #

    Thanks a lot for this, I was really searching a fix for wp2.5

  2. Jon | 01 Apr 2008 @ 16:54 #

    You’re welcome. I know how aggravating this problem was.

  3. Pat | 06 Apr 2008 @ 5:58 #


    That was a very quick and easy help! Thanks very much.

  4. Jon | 06 Apr 2008 @ 6:27 #

    No problem, Pat.

  5. Jake Rutter | 08 Apr 2008 @ 17:25 #

    I cant get this to work and its driving me nuts!

  6. Jon | 08 Apr 2008 @ 18:13 #

    Jake, can you give me some more details about what all you have tried and the errors?

  7. Art Lee | 18 Apr 2008 @ 23:17 #

    This worked for me. I did not have an .htaccess file, but put the above code by itself into a new .htaccess file and it worked fine. Thx.

  8. Mario | 01 May 2008 @ 5:30 #

    Thanks man, that worked for me! But what was actualy wrong with 2.5? Why was that needed?

  9. Jon | 01 May 2008 @ 6:30 #

    I honestly don’t know what changed in WP2.5 to cause this error. The only thing that comes to mind is the new Flash uploader, but that may have nothing to do with the error itself.

  10. renato | 16 May 2008 @ 5:55 #

    I saw that the server doesn’t recognize the esistence of the “uploads” folder and once You have created it again, after you upload a file, it doesn’t recognize the folder again, telling me the “uploads” folder doesn’t exist.

  11. Russ | 22 May 2008 @ 9:22 #


    Thanks for the tip, but I still get the ‘http error’ message when I try uploading with the Flash thing. Here’s my .htaccess file. Maybe I have it in the wrong place in the file?

    RewriteEngine On
    RewriteBase /

    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    SecFilterEngine Off
    SecFilterScanPOST Off


    Thanks for any help.

  12. Jon | 22 May 2008 @ 9:29 #

    It looks like parts of the rules are missing (update: I just realized that some of that is because the comment was reformatted). For example, here is my full .htaccess file:

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

    # END WordPress

    <IfModule mod_security.c>
    <Files async-upload.php>
    SecFilterEngine Off
    SecFilterScanPOST Off

    Be sure that the rules are exactly like the example in the original post.

  13. Jon | 22 May 2008 @ 9:43 #

    Under WordPress -> Settings – > Miscellaneous make sure your uploads folder is set to wp-content/uploads

    Also check the permissions on the uploads folder. Mine are set to 755.

  14. Andre | 04 Jun 2008 @ 22:16 #

    Thanks a lot. Now fixed.

  15. Avram | 07 Jun 2008 @ 23:48 #


    Just moved my wordpress 2.5 installation to a new server and everything works ok, except now I am getting this HTTP error when I try to upload images and one other odd thing, I get a 404 page when I try to hit Save when editing a post.

    I followed the instructions above and they haven’t helped at all. Here’s my .htaccess file, which is located in the public_html folder of my account (the main wordpress folder is /wpress). Any idea at all what I could be doing wrong?

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    SecFilterEngine Off
    SecFilterScanPOST Off

  16. Jon | 08 Jun 2008 @ 8:50 #

    Avram, your .htaccess needs to be in your /wpress folder, not the public_html folder.

  17. Pete | 24 Jun 2008 @ 4:31 #

    I’ve tried changing my permissions to 755 on my my ‘upload’ folder, but it still doesn’t work. I’m going to try the .htaccess approach. Sorry to sound simple but this .htaccess file, it will have to have a name, can it be anything e.g.
    file.htaccess? This .htaccess file will go in my wp-admin folder, is this right.

    Hope you can help.

  18. Jon | 24 Jun 2008 @ 5:48 #


    That is the entire name of the .htaccess file — .htaccess

    The .htaccess file does not need to go in your wp-admin folder. It needs to go up one level and in the same folder as wp-app.php, wp-atom.php, etc.

  19. Pete | 24 Jun 2008 @ 8:12 #

    Eureka and thanks very much, that has indeed worked. Well almost! The image doesn’t appear but a placeholder does. I’ve looked at the html and it has a sort of date like this
    wp-content/uploads/2008/06/file name.jpg
    If I delete the 2008/06/ from the html it works perfectly. Would you know of a way to get rid of the date part of the html?

    Thanks again


  20. Jon | 24 Jun 2008 @ 8:24 #

    You may need to play with your settings under “Miscellaneous”. It sounds like the problem lies there. Here is how mine is set:

    Store uploads in this folder: wp-content/uploads
    Full URL path to files (optional)
    (checked) Organize my uploads into month- and year-based folders

  21. Pete | 24 Jun 2008 @ 10:43 #

    Many thanks again, that was the problem. I have another! I’m trying to style the images e.g.”alignleft”. I’ve looked at my style.css and entered a alignleft class and uploaded it, but it’s ignored. Which stylesheet are the image styles in?
    I have my WordPress in a sub folder of my static website. http://www.mywebsite.com/blog/wp-content/themes/mythemefolder/style.css

    I’ve also tried changing the blog/wp-admin/css/global.css but that does not work either. If you have time I’d grateful for any advice. Thanks.

  22. Jon | 24 Jun 2008 @ 11:00 #


    Your style.css will probably be different than mine, but the idea is to find the style for img for entry, and add some classes to them

    div#page div#main div#leftside div.post div.entry img.alignleft {float: left}
    div#page div#main div#leftside div.post div.entry img.alignright {float: right}
    div#page div#main div#leftside div.post div.entry img.aligncenter {text-align: center}

    Hopefully this will get you headed in the right direction.

  23. Pete | 26 Jun 2008 @ 3:39 #

    Thanks again for your expert help. I’m now in the right direction.

  24. Jon | 26 Jun 2008 @ 6:04 #

    I’m happy I could help, Pete.

  25. SilentDog | 03 Jul 2008 @ 4:39 #

    Thanks for the solution! Finally I can upload the images again.

  26. Jon | 03 Jul 2008 @ 5:18 #

    You’re welcome, SilentDog.

  27. Azmi Taufik | 10 Jul 2008 @ 8:18 #

    Thanks for the tips. I just copy and paste your tips into my .htaccess file and successfully upload the required files.

    Thanks again.

  28. Saulo | 29 Aug 2008 @ 18:13 #

    Thanks–this fixed my problem!


  29. schmaart | 28 Nov 2008 @ 17:44 #

    beautiful fix – many thanks.

  30. Reflex | 01 Jan 2009 @ 17:25 #

    Wow, thanks this works also in WP 2.7.

  31. [...] googling around, I figured out the similar problem here. Though in my case .htaccess file was blank (in root www directory of wordpress). I added following [...]

  32. Chika | 10 Aug 2009 @ 1:33 #

    This tips didn’t work on mine. here is my .htaccess content

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    SecFilterEngine Off
    SecFilterScanPOST Off

    i’ve set the uploads folder permission to 755 too. but the error message “HTTP Error. An error occurred in the upload. Please try again later.” is still occured. Why is this happen? thx..

  33. Chika | 10 Aug 2009 @ 1:35 #

    by the way, I use WP 2.7 on my site. thx..

  34. Jon | 10 Aug 2009 @ 7:32 #


    Have you tried using the “Browser uploader” instead of the default flash uploader? Under the “Select Files” button there is a link to the “Browser uploader”.

  35. Chika | 10 Aug 2009 @ 21:06 #

    Yes, I’ve tried “Browser uploader” too. I try big (2.69MB) and small pictures (59KB), but it still error. The error message are:

    “ALERT – script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker ‘xxx.xx.xxx.xx’, file ‘/home/sloki/user/mySITE/sites/mySITE/www/wp-admin/includes/image.php’, line 146) ALERT – script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker ‘xxx.xxx.xxx.xxx’, file ‘/home/sloki/user/mySITE/sites/mySITE/www/wp-admin/includes/image.php’, line 146) ALERT – script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker ‘xxx.xxx.xxx.xxx’, file ‘/home/sloki/user/mySITE/sites/mySITE/www/wp-admin/includes/image.php’, line 146) Status: 302 Moved Temporarily X-Powered-By: PHP/5.2.6-1+lenny3 Expires: Wed, 11 Jan 1984 05:00:00 GMT Last-Modified: Tue, 11 Aug 2009 03:02:34 GMT Cache-Control: no-cache, must-revalidate, max-age=0 Pragma: no-cache Location: http://mySITE/wp-admin/upload.php Content-Type: text/html; charset=UTF-8″

    But those pictures are successfully uploaded to my gallery, though…But why there’s still an error?

  36. Jon | 11 Aug 2009 @ 9:23 #


    This “script tried to increase memory_limit” sounds like a configuration issue with your host. You might try to contact whoever is hosting your WordPress installation and inform them of the error.

  37. Vassileios Mastorostergios | 01 May 2010 @ 12:26 #


    I know this is an old post but believe it or not, I’m facing the exact same problem with WP 2.8.3

    I’m pasting your code in the .htaccess file and it works for about 10 minutes, then the .htaccess revents completely on its own and replaces your code with this:

    # Engine Off
    # ScanPOST Off

    Any ideas?

  38. Jon | 01 May 2010 @ 15:42 #


    Are you sure that you put the above text after the “END WordPress”?

    My only other idea is that you may have some plugin that is editing your .htaccess file.


  39. Ganesan K | 16 Aug 2011 @ 23:31 #

    Thanks for sharing a good info.. Keep posted..

  40. Philip Thomas | 17 May 2012 @ 13:33 #

    So, the solution in the end was have support go through several possibilities. At first, support thought it was WordPress itself creating the errors, but infact it was simply a case of turning off FastCGI in the PHP options/manage domain panel and switch it to PHP 5.3xCGI.
    Now, images upload without a issue. Hopefully this will help someone else with the same problem.

Add a Comment

Show who you are with a Gravatar.


Sign up for PayPal and start accepting credit card payments instantly.

Staples Logo

Get fed!

rss icon subscribe to Geek stuff

rss icon Geek stuff in your inbox

Add the "Geek stuff" Google Gadget to your homepage

Add the "Daily Deals" Google Gadget to your homepage


Search Amazon

Search Amazon.com
Search Amazon.co.uk

Recent Forum Topics


    Web hosting by ICDSoft