-2

在自定义模块中出现以下错误我无法理解如何解决这个问题......提前致谢

2013-03-12T08:56:16+00:00 ERR (3): 
exception 'Exception' with message '$_FILES array is empty' in D:\wamp\www\magentotest\lib\Varien\File\Uploader.php:467
Stack trace:
#0 D:\wamp\www\magentotest\lib\Varien\File\Uploader.php(149): Varien_File_Uploader->_setUploadFileId('thumbnail')
#1 D:\wamp\www\magentotest\app\code\core\Mage\Catalog\Model\Category\Attribute\Backend\Image.php(57): Varien_File_Uploader->__construct('thumbnail')
#2 [internal function]: Mage_Catalog_Model_Category_Attribute_Backend_Image->afterSave(Object(Mage_Catalog_Model_Category))
#3 D:\wamp\www\magentotest\app\code\core\Mage\Eav\Model\Entity\Abstract.php(657): call_user_func_array(Array, Array)
#4 D:\wamp\www\magentotest\app\code\core\Mage\Eav\Model\Entity\Abstract.php(1648): Mage_Eav_Model_Entity_Abstract->walkAttributes('backend/afterSa...', Array)
#5 D:\wamp\www\magentotest\app\code\core\Mage\Catalog\Model\Resource\Category.php(235): Mage_Eav_Model_Entity_Abstract->_afterSave(Object(Mage_Catalog_Model_Category))
#6 D:\wamp\www\magentotest\app\code\core\Mage\Eav\Model\Entity\Abstract.php(1124): Mage_Catalog_Model_Resource_Category->_afterSave(Object(Mage_Catalog_Model_Category))
#7 D:\wamp\www\magentotest\app\code\core\Mage\Core\Model\Abstract.php(318): Mage_Eav_Model_Entity_Abstract->save(Object(Mage_Catalog_Model_Category))
#8 D:\wamp\www\magentotest\app\code\core\Mage\Catalog\data\catalog_setup\data-install-1.6.0.0.php(53): Mage_Core_Model_Abstract->save()
#9 D:\wamp\www\magentotest\app\code\core\Mage\Core\Model\Resource\Setup.php(624): include('D:\wamp\www\mag...')
#10 D:\wamp\www\magentotest\app\code\core\Mage\Core\Model\Resource\Setup.php(391): Mage_Core_Model_Resource_Setup->_modifyResourceDb('data-install', '', '1.6.0.0.14')
#11 D:\wamp\www\magentotest\app\code\core\Mage\Core\Model\Resource\Setup.php(289): Mage_Core_Model_Resource_Setup->_installData('1.6.0.0.14')
#12 D:\wamp\www\magentotest\app\code\core\Mage\Core\Model\Resource\Setup.php(269): Mage_Core_Model_Resource_Setup->applyDataUpdates()
#13 D:\wamp\www\magentotest\app\code\core\Mage\Core\Model\App.php(351): Mage_Core_Model_Resource_Setup::applyAllDataUpdates()
#14 D:\wamp\www\magentotest\app\Mage.php(683): Mage_Core_Model_App->run(Array)
#15 D:\wamp\www\magentotest\index.php(87): Mage::run('', 'store')
#16 {main}
4

1 回答 1

2

如果没有代码示例,创建文件上传表单时的一个常见错误是忘记将 enctype 设置为 multipart/form-data。使用 Magento 时创建具有正确设置此属性的表单的示例代码:

$form = new Varien_Data_Form(array(
        'id' => 'edit_form',
        'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
        'method' => 'post',
        'enctype' => 'multipart/form-data'
    )
);

参考: http: //www.magentocommerce.com/wiki/5__-_modules_and_development/admin/how_to_create_pdf_upload_in_backend_for_own_module

于 2013-03-12T10:52:16.503 回答