在自定义模块中获取以下错误我无法理解如何解决此问题...提前感谢
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}
答案 0 :(得分:1)
如果没有代码示例,创建文件上传表单时常见的错误是忘记将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'
)
);