There are many things that could be causing this issue, but here's a few things you could try:
Make sure the /media directory and all subdirectories have your Apache's user's group (usually 'www-data' or 'httpd'):
sudo chgrp -R www-data /path/to/magento/media
Make sure the /media directory and all subdirectories have appropriate permissions given to your Apache's user's group:
sudo chmod -R 775 /path/to/magento/media
In System->Configuration->General->Web, make sure "Base URL" and "Base Media URL" are correct under both "Secure" and "Unsecure"
In your Magento database, the table core_config_data
contains the raw values for your {{secure_base_url}}
and {{unsecure_base_url}}
Make sure these values are correct and have trailing slashes, like http://example.com/
In the system configuration above, make sure those values are correct accounting for the trailing slash in the raw value. This means they should look like {{secure_base_url}}media
for example, with no slashes
In System->Cache Management, disable caching
Take the .htaccess files from a fresh download of your version of Magento (including the .htaccess in your document root, and any .htaccess files in /media and all subdirectories of /media), back up your current .htaccess files, then explicitly copy the fresh .htaccess files to replace them.
Because .htaccess starts with the '.' character, it will be ignored by certain Linux commands, which can cause people to think they've copied or overwritten a .htaccess file when they actually haven't, so do this carefully.
Now try again, and if you get the same error, that'll rule out .htaccess.
If you're using SSL, try disabling SSL and if you get the same error, that'll rule out SSL
Navigate to app/code/local
and app/code/community
and make note of the namespaces in those directories. Now go to app/etc/modules
and edit every *.xml file in that directory matching the namespaces you noted with the following value for the <active>
node:
<?xml version="1.0"?>
<config>
<modules>
<Namespace_*>
<!-- set this value to "false" -->
<active>false</active>
<!-- more nodes here, just leave every
node alone except <active> -->
</Namespace_*>
</modules>
<config>
Now try again, and if you get the same error, that'll rule out module conflicts
If the images are large enough, you may be restricted by your PHP settings:
Identify your loaded php.ini:
<?php
phpinfo(); // Look for "Loaded Configuration File"
Edit your php.ini (if you're on Ubuntu it was probably in /etc/php5/apache2/php.ini
):
sudo vi /path/to/php.ini
# Make these three values higher than the filesize of the images you're
# trying to upload:
upload_max_filesize = 200M
post_max_size = 200M
memory_limit = 200M
Restart your webserver:
sudo /etc/init.d/apache2 restart
If you've gotten this far and nothing has worked, here are some time-intensive things you could do to narrow down what kind of problem it is:
If you'd like to provide more information, probably the most useful pieces would be a copy of your loaded php.ini
, apache2.conf
and/or httpd.conf
, and copies of your .htaccess
files from document root
through all subdirectories of /media
, with any sensitive information obfuscated of course.