简体   繁体   中英

Unable to upload images after update to Magento 1.9.0.1

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?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM