Magento http upload error due to 401 authorization

Magento 401 unauthorized

If you want to ignore my blabber and just want the solution, go to the bottom of post and read the TL;DR.

This is a really strange thing to happen. I am working on a Magento project and for some testing I had to upload some images for a product. Nothing new.

So, on images tab, I casually selected a file and clicked the Upload files button. Suddenly the progress bar went red saying “upload HTTP error”. Meh. Probably something went wrong with my internet connection. Tried again and still failed.

Engage Google ninja mode. Everyone said it was a permissions issue to media folder. I checked and the permissions were fine. Why wouldn’t they be! Nothing had changed on the site. A list of possible causes:

  • Media folder permissions
  • PHP upload limit for file size
  • Cache issues
  • etc

Then I started recalling what changes have been made to file system or anything else on machine. Sure I edited some files but those shouldn’t have any affect on media folder. Apart from that I had added HTTP 401 authorization to the site so that it is not available to general public before launch. Why not try it as well!

So I went ahead, opened htaccess file and removed the instructions for HTTP 401. Went back to admin, tried uploading image again and voila! Image uploaded successfully.

Lesson learnt: Add 401 check to list in case such error occurs.

TL;DR : If you have HTTP 401 authorization implemented for you magento installation, you will (may?) face HTTP upload error while uploading product images.

Leave a Reply