Are there any reliable ways of disabling the Flash uploader and using the 'classic' uploader? Is this even possible without using an extension?

I'm just normally trying to upload an image via the admin - both /var and /media (and all sub-folders) are set to 777. The response I get back is:

{"error":"File was not uploaded.","errorcode":666}

up vote 8 down vote accepted

Explanation

This error comes from Varien_File_Uploader::__construct() in lib/Varien/File/Uploader.php

Here are the important parts

<?php

class Varien_File_Uploader
{
    /**
     * Uploaded file handle (copy of $_FILES[] element)
     *
     * @var array
     * @access protected
     */
    protected $_file;

    const TMP_NAME_EMPTY = 666;

    function __construct($fileId)
    {
        $this->_setUploadFileId($fileId);
        if(!file_exists($this->_file['tmp_name'])) {
            $code = empty($this->_file['tmp_name']) ? self::TMP_NAME_EMPTY : 0;
            throw new Exception('File was not uploaded.', $code);
        } else {
            $this->_fileExists = true;
        }
    }
}

Looking back up the tree you see this is called

$uploader = new Mage_Core_Model_File_Uploader('image');

Which is extended from the Varien class, so the Varien_File_Uploader::_setUploadFileId($fileId) will construct the $this->_file array based on the key image, in this case.

So now the problem is why is $_FILES['image']['tmp_name'] empty?

I checked the 'error' field by temporarily replacing it with throw new Exception('File was not uploaded. ' . $this->_file['error'], $code);

I got 7, which is Failed to write file to disk. Introduced in PHP 5.1.0. which means it's a permissions issue.

Solution

Do a phpinfo() to check where your upload_tmp_dir is set to and make sure it's writable.

In my case, I was out of file space in the /tmp dir of my server.

I've always used the No Flash Image Uploader, which worked with CE v1.4 - v1.7 without issue. The module is no longer available via Magento Connect, though its source code is actively maintained (as of Oct. 2016) and is available on GitHub.

You could grab the extension code and just extract the portion that you need if really necessary.

  • That item MageBayVaporated and seems to no longer be available. – Fiasco Labs Feb 2 '16 at 18:43
  • I already installed. it's working well on product image upload, but in downloadable product file upload, it won't work. Do you have any other alternate solution for accomplishing without flash on downloadable product page downloadable section – senthil Feb 22 at 16:35

I would say: "no". This is not possible out-of-the-box, but I found a plugin:

http://www.paoloiannelli.com/2012/07/30/how-to-disable-flash-uploader-magento/

I had the same, but I had an update of windows. Rebooted computer and everything worked again

You can find here a Magento extension that allow multi-images upload using jquery and no flash : https://www.magentocommerce.com/magento-connect/multi-images-uploader-jquery-no-flash.html

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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