cancel
Showing results for 
Search instead for 
Did you mean: 

Uploader broken

Uploader broken

Hello,

 

I have found lot of topic with the same problem but 0 answers was ok for me.

After patch, i have button uploader and download for product image, but this don't work.

 

i have this error : 

Uncaught ReferenceError: Uploader is not defined
    at (index):1727
    at (index):1732
(anonymous) @ (index):1727
(anonymous) @ (index):1732

My uploader.phtml is : 

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     default_default
 * @copyright   Copyright (c) 2006-2017 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * @var $this Mage_Uploader_Block_Multiple|Mage_Uploader_Block_Single
 */
?>
<div id="<?php echo $this->getHtmlId() ?>" class="uploader">
    <div class="buttons a-right">
        <?php echo $this->getBrowseButtonHtml(); ?>
        <?php echo $this->getUploadButtonHtml(); ?>
    </div>
</div>
<div class="no-display" id="<?php echo $this->getElementId('template') ?>">
    <div id="{{id}}-container" class="file-row">
        <span class="file-info">{{name}} {{size}}</span>
        <span class="delete-button"><?php echo $this->getDeleteButtonHtml() ?></span>
        <span class="progress-text"></span>
        <div class="clear"></div>
    </div>
</div>
<script type="text/javascript">
    (function() {
        var uploader = new Uploader(<?php echo $this->getJsonConfig(); ?>);

        if (varienGlobalEvents) {
            varienGlobalEvents.attachEventHandler('tabChangeBefore', uploader.onContainerHideBefore);
        }
    })();
</script>
<?php echo $this->getChildHtml('additional_scripts'); ?>

I have SWF files and the 4 media folders.

Someone have an idea ?

 

Sorry for my english

 

Thanks ! Smiley Happy

6 REPLIES 6

Re: Uploader broken

@jrouzot1998896 

 

It could be permission issue so you can set up permission for below shared:

 

js/image/adminhtml/uploader

and 

js/lib/uploader,

 

Or 

magento 1.9.3.0 they remove the flash uploader so js file need to run uploader add these file in head

<reference name="head">
            <action method="addJs"><file>lib/uploader/flow.min.js</file></action>
            <action method="addJs"><file>lib/uploader/fusty-flow.js</file></action>
            <action method="addJs"><file>lib/uploader/fusty-flow-factory.js</file></action>
            <action method="addJs"><file>mage/adminhtml/uploader/instance.js</file></action>
</reference>

 

Please have look for more:

https://stackoverflow.com/questions/13030205/magento-uploaderjsobject-is-not-defined

Manish Mittal
https://www.manishmittal.com/

Re: Uploader broken

Hi,

Thank for your answer but i have again the error : 

(index):1727 Uncaught ReferenceError: Uploader is not defined
    at (index):1727
    at (index):1732
(anonymous) @ (index):1727
(anonymous) @ (index):1732

 

i'm on 1.7.0.2, 

and both forlder uploader are on permission 775 :s

 

Do you know, where is define class Uploader ? Maybe she's missing in my code

 

Thank you

Re: Uploader broken

Hi @jrouzot1998896 

Kindly refer below URL:
https://ipfs-sec.stackexchange.cloudflare-ipfs.com/magento/A/question/141775.html

It will help you to resolve issue.

If issue resolve, Please click on 'Kudos' & Accept as Solution!

Problem solved? Click Accept as Solution!

Re: Uploader broken

Hello

Thank for your answer,

 

He has the same problem but he is talking about code into module : '

_Edit_Tab_Images extends Mage_Adminhtml_Block_Widget

I only touch CORE Magento, i don't want use community or local module,

 

 

Re: Uploader broken

Hello @jrouzot1998896 

 

have you installed this patch > SUPEE 11219 has uploader.php file changes.

app/code/core/Mage/Core/Model/File/Uploader.php

https://magento.stackexchange.com/questions/292092/supee-11219-potential-issues

 

Suggestions
1. Try installing the patch from pre patched files

https://github.com/magecomp/Magento-Pre-Patched-Files/tree/master/SUPEE-11219

2. Upgrade your Magento version to latest Magento 1.9.4.3 which includes all the security patches.

 

Manish Mittal
https://www.manishmittal.com/

Re: Uploader broken

Hello,

 

Yes i already publish all patch on the website, and i have uploader.php 

 

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Mage
 * @package     Mage_Core
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */


/**
 * Core file uploader model
 *
 * @category   Mage
 * @package    Mage_Core
 * @author     Magento Core Team <core@magentocommerce.com>
 */
class Mage_Core_Model_File_Uploader extends Varien_File_Uploader
{
    /**
     * Flag, that defines should DB processing be skipped
     *
     * @var bool
     */
    protected $_skipDbProcessing = false;

    /**
     * Max file name length
     *
     * @var int
     */
    protected $_fileNameMaxLength = 200;

    /**
     * Save file to storage
     *
     * @param  array $result
     * @return Mage_Core_Model_File_Uploader
     */
    protected function _afterSave($result)
    {
        if (empty($result['path']) || empty($result['file'])) {
            return $this;
        }

        /** @var $helper Mage_Core_Helper_File_Storage */
        $helper = Mage::helper('core/file_storage');

        if ($helper->isInternalStorage() || $this->skipDbProcessing()) {
            return $this;
        }

        /** @var $dbHelper Mage_Core_Helper_File_Storage_Database */
        $dbHelper = Mage::helper('core/file_storage_database');
        $this->_result['file'] = $dbHelper->saveUploadedFile($result);

        return $this;
    }

    /**
     * Getter/Setter for _skipDbProcessing flag
     *
     * @param null|bool $flag
     * @return bool|Mage_Core_Model_File_Uploader
     */
    public function skipDbProcessing($flag = null)
    {
        if (is_null($flag)) {
            return $this->_skipDbProcessing;
        }
        $this->_skipDbProcessing = (bool)$flag;
        return $this;
    }

    /**
     * Check protected/allowed extension
     *
     * @param string $extension
     * @return boolean
     */
    public function checkAllowedExtension($extension)
    {
        //validate with protected file types
        /** @var $validator Mage_Core_Model_File_Validator_NotProtectedExtension */
        $validator = Mage::getSingleton('core/file_validator_notProtectedExtension');
        if (!$validator->isValid($extension)) {
            return false;
        }

        return parent::checkAllowedExtension($extension);
    }

    /**
     * Used to save uploaded file into destination folder with
     * original or new file name (if specified).
     * Added file name length validation.
     *
     * @param string $destinationFolder
     * @param string|null $newFileName
     * @return bool|void
     * @throws Exception
     */
    public function save($destinationFolder, $newFileName = null)
    {
        $fileName = isset($newFileName) ? $newFileName : $this->_file['name'];
        if (strlen($fileName) > $this->_fileNameMaxLength) {
            throw new Exception(
                Mage::helper('core')->__("File name is too long. Maximum length is %s.", $this->_fileNameMaxLength)
            );
        }
        return parent::save($destinationFolder, $newFileName);
    }
}