更新到新版本1.9.3之后。上传器不再工作。下面给出error.i更新我的代码,但仍然相同。
var uploader = new
Uploader({“ uploaderConfig”:{“ chunkSize”:1073741824,“ withCrede ...
下面是我的代码
class Spacename_Modulename_Block_Adminhtml_Modulename_Edit_Tab_Images extends Mage_Adminhtml_Block_Widget {
protected $_uploaderType = 'uploader/multiple';
protected function _prepareForm() {
$data = $this->getRequest()->getPost();
$form = new Varien_Data_Form();
$form->setValues($data);
$this->setForm($form);
return parent::_prepareForm();
}
protected function _prepareLayout() {
$this->setChild('uploader', $this->getLayout()->createBlock($this->_uploaderType)
);
$this->getUploader()->getUploaderConfig()
->setFileParameterName('image')
->setTarget(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/image'));
$browseConfig = $this->getUploader()->getButtonConfig();
$browseConfig
->setAttributes(array(
'accept' => $browseConfig->getMimeTypesByExtensions('gif, png, jpeg, jpg')
));
return parent::_prepareLayout();
}
}
js代码
<script type="text/javascript">
//<![CDATA[
var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', <?php echo $_block->getImageTypesJson() ?>);
//]]>
</script>