2

I have been running for a long time and recently moved to a different server and upgraded to Magento 1.9 from 1.8. After the usual hickups everything seems to work, except for uploading images to products (and in the WYSIWYG editor).

Flash works and I can use the buttons to select the image, afterwards the uploading bar runs up to 100% and then the error "File was not uploaded." appears.

I have been looking for all possible problems and checked the following:

  • Image is not too big (I tried several different images from 1kb to 2mb)
  • The error occurs with new products, as well as on existing products with images
  • All media folders have chmod 777
  • The error exists in all browsers (IE, FF and Chrome)
  • Magento is running on a private VPS, with plenty of empty disk space
  • The image do not show up in the media/tmp folder nor the media/catalog folder
  • Alle images have always been imported through the Magento backend
  • I have tried if removing the .htaccess file from media folder helps (it doesn't)
  • I tried uploading the image in global view as well in store view

How to solve this problem? Or at least find the reason for its occurrence?

Giel
  • 21
  • 1
  • 5

2 Answers2

0

Edit the file lib/Varien/File/Uploader.php and add Mage::log() inside the save() function.

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

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

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


}

or to another places in thic class and get exact error ... File will be saved at configured Magento exceptions and logs files folder.

Martin
  • 2,575
  • 6
  • 32
  • 53
  • The log displays: ` 2014-10-01T14:31:45+00:00 ERR (3): Warning: file_exists(): oopen_basedir restriction in effect. File(/var/zpanel/temp/phpmFoCp3) is not within the allowed path(s): (/var/zpanel/hostdata/zadmin/public_html/hogty_com:tmp/magento/var) in /var/zpanel/hostdata/zadmin/public_html/hogty_com/includes/src/Varien_File_Uploa‌​der.php on line 150 ` However, I am not advanced enough to understand this. I believe that something is in the wrong place, or has the wrong permision, but don't understand it entirely. Any further help would be appreciated. – Giel Oct 01 '14 at 17:11
  • If you are on hosting and do not have access to configuration (htacces, vhosts), send this error to your provider, Or you can change PHP settings, related issue: http://stackoverflow.com/questions/1846882/open-basedir-restriction-in-effect-file-is-not-within-the-allowed-paths – Martin Oct 01 '14 at 17:25
0

please open your inspect Element(q) in Firefox or chrome and check console tab and if you find the error as "Uncaught Error: Function name must be a string in C:\MAMP or wamp or xamp\htdocs or www\magento\lib\Varien\File\Uploader.php:259" then you can fix it from following solution.

-first you should open Uploader.php from C:\MAMP or wamp or xamp\htdocs or www\magento\lib\Varien\File\Uploader.php and going to 259 line find this code

    $params['object']->$params['method']($this->_file['tmp_name'])

and the change it to

    $params['object']->{$params['method']}($this->_file['tmp_name']);

i just add {} around $params['method'] and it is work i think this error is come from changing your php version

moein kh
  • 479
  • 2
  • 14