9

I am unable to upload images in magento admin panel , getting error "Destination folder is not writable or doen't exist". Recently moved all files from one hosting to another. Any solution for this?

  • What sort of hosting package do you have? If it includes support might be worth asking them about the current permissions. – David Manners Jan 7 '14 at 6:50
  • We have two websites hosted on same server and we have all permissions to upload a file and even though files are not uploading – user3164549 Jan 7 '14 at 6:59
16

In your project open the file lib/Varien/File/Uploader.php and put a Mage::log() inside the save() function.

public function save($destinationFolder, $newFileName = null)
{
    $this->_validateFile();

    if ($this->_allowCreateFolders) {
        $this->_createDestinationFolder($destinationFolder);
    }

    if (!is_writable($destinationFolder)) {
        // Put a mage::log() and check what is the folder magento is looking for.
        Mage::log($destinationFolder);
        throw new Exception('Destination folder is not writable or does not exists.');
    }
    ...
}

From the log you can find out the folder which Magento is looking for. And then check permissions for that folder.

  • 5
    Thank you so much i forgetted to give file permission to Media/tmp/category/product, and after giving the file permission to that folder the problem has resolved – user3164549 Jan 7 '14 at 7:20
  • 2
    Glad to hear your problem was solved. If this was helpful solve the issue please mark it as the answer. – Sukeshini Jan 7 '14 at 7:24
4

Magento 2

I get the same error on Magento 2, and this is the file where the error come from in this case:

vendor/magento/framework/File/Uploader.php

At line 256 you can temporarily place this code to get the unwritable/unexisting folder:

if( !is_writable($destinationFolder) ) {
    // throw new Exception('Destination folder is not writable or does not exists.');
    throw new Exception($destinationFolder);
} 

Otherwise, check if these folders exists and that are writable by the web server:

  • pub/media/catalog/
  • pub/media/catalog/category
  • pub/media/catalog/product
  • pub/media/images
  • pub/media/wysiwyg/
3

For my the problem was solved by making

pub/media/tmp

writable by the web server

The next folders under "pub/media" directory also are writables

- banners
- catalog
- images
- wysiwyg
3

For what its worth I've had this issue a few times and have forgotten that it's usually the image file itself, not the server after verifying permissions and all that. It still wouldn't upload the image because it was too large, either in dimensions or in filesize.

The solutions for me are to:

2

Make sure that the media folder media/tmp/catalog/product exist "and make that directory writable by your webserver"

  • Instead of setting the permission to 777, it's better to say "and make that directory writable by your webserver". The idea is that there is no need to give every single user write access just so that your webserver can write images. (I'm not the one who downvoted, but just in case you were wondering, this is most likely the reason why) – Dan Aug 25 '15 at 13:48
  • yes of course ;) – Altravista Aug 26 '15 at 13:34
2

Kindly check media folder having 777 permission.If you are enable the compilation mode means also check includes folder having 777 permission.

After giving 777 permission to those folders issue resolved for me.

0

It may be the expired certificate from the Plesk administration (it was my case).

I tried the steps above, but it did not work. From there I tried to access the files through FileZilla to give the permissions at once to all folders, hence an error message about the expired certificate. It is not the SSL certificate of the store itself, but the administration of Plesk. I created a new self-signed certificate, applied its Plesk administration and everything went back to normal.

This worked for me. I leave here my contribution.

Good luck

0

There is a bug in Magento for file upload when your magento DocumentRoot on vhost is properly set for

/path/to/magento/pub

Instead of (deprecated)

/path/to/magento

Uploader tries to create files in

/path/to/magento/pub/pub/your_upload_dir

Note that location pub goes twice. They told they will fix it in 2.2.0+ but in 2.2.1 this problem still appear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.