Magento. Destination folder is not writable or does not exists
Solution 1
There's only one spot in the Magento code base that uses that error language.
File: lib/Varien/File/Uploader.php
...
if( !is_writable($destinationFolder) ) {
throw new Exception('Destination folder is not writable or does not exists.');
}
...
Add some temporary debugging code right above this
...
if( !is_writable($destinationFolder) ) {
Mage::Log($destinationFolder);
//or
var_dump($destinationFolder);
throw new Exception('Destination folder is not writable or does not exists.');
}
...
This will let you know the exact folder Magento wants to write to, but can't. Examine this folder, and you'll find it's not writable. Reviewing the edge cases on is_writable may also shed some light on the subject.
Solution 2
Goto : lib/Varien/File/Uploader.php
Temporary change the following code and try to upload image. Now in error message you can see folder path. In folder path you have to give file permission 777 and it will work as normal. After the error is resolved revert your code to as it wass.
if( !is_writable($destinationFolder) ) {
var_dump($destinationFolder);
throw new Exception(''.$destinationFolder.'Destination folder is not writable or does not exists.');
}
Solution 3
I got the below error while uploading images in Magento then I did the below steps and that worked for me.
Cd /var/www/
chmod 755 -R /html
chown apache:apache -R /html
setenforce 0
then restart apache ..
slavig
Updated on July 09, 2022Comments
-
slavig almost 2 years
Hey I'm stuck with the following problem, plz help.
I get "Destination folder is not writable.." when trying to add an image to a product, but the permission for all needed folders is 777! I had deleted all files on server, didn`t touch DB, reinstalled Magento from scratch with new DB, and everything is OK. But when I switched to previous DB (change settings in the local.xml) the bug appeared again.
How can the DB impact the folder permissions?
UPDATE:
Thanx a lot, we found out that Magento jump from this method:
public function getBaseMediaUrl() { return Mage::getBaseUrl('media') . 'catalog/product'; }
to the following method:
public function getBaseTmpMediaUrl() { return Mage::getBaseUrl('media') . 'tmp/catalog/product'; }
Does anybody know why and how????
-
slavig about 13 yearsThanx a lot, we found out that Magento jump from a method /n 'public function getBaseMediaUrl() { return Mage::getBaseUrl('media') . 'catalog/product'; }'
-
SPRBRN almost 11 yearsFor me the var_dump doesn't work, and the exception is not displayed. Changing the exception works better:
throw new Exception('Destination folder is not writable or does not exist: ' . $destinationFolder);
. This displays the following path:media/tmp/catalog/product
. -
JinnKo over 3 yearsFriends don't tell friends to
chmod 777 ...