0
 $fieldset->addField('image', 'image', array(
 'label' => Mage::helper('featuredsalons')->__('Image'),
 'required' => true,
 //'multiple' => true, 
 //'multiple' => 'multiple', 
 'name' => 'image',
 'after_element_html' => '<p class="note"><span>Image Dimension: </span></p>'
 ));

I have tried above mentiion to allow multple images , but failed.

Fabian Blechschmidt
35.4k8 gold badges76 silver badges183 bronze badges
asked Aug 27, 2013 at 13:22
1
  • If it is enough, you can just add multiple file input fields. Is multiple limited? Or is multiple 0+? Commented Aug 27, 2013 at 19:20

3 Answers 3

1

The only "multiple image" widget available in a default Magento install is the EAV Attribute type gallery.

I'm pretty sure however that you'll need to implement the same Adminhtml_Widgets in order to use it on something other than a product (like a custom EAV Entity with a custom form).

If you just need a custom form (without a custom entity or for a custom Flat entity) you may be better off creating your own Controllers and implementing SWF Upload yourself using your own logic/structures.

answered Aug 27, 2013 at 13:39
1

You should change this function getElementHtml in this file lib\Varien\Data\Form\Element\Abstract.php like this:

public function getElementHtml(){
 if($this->getType()=='file' && $this->getMultiple())
 $_multiple = ' multiple';
 $html = '<input id="'.$this->getHtmlId().'" name="'.$this->getName()
 .'" value="'.$this->getEscapedValue().'" '.$this->serialize($this->getHtmlAttributes()).$_multiple.'/>'."\n";
 $html.= $this->getAfterElementHtml();
 return $html;
 }

after that you able to upload multiple file with your file field

Example: In form file

 $fieldset->addField('optionimage', 'file', array(
 'label' => Mage::helper('option_module')->__('Option Image'),
 'required' => false,
 'name' => 'optionimage[]',
 'multiple'=>true,
 'multiple'=>'multiple'
 ));

and in your controller

Sander Mangel
37.6k5 gold badges81 silver badges149 bronze badges
answered Jun 25, 2015 at 10:43
1
  • Never edit core files! Commented Jun 25, 2015 at 10:54
0

You should change your 'name' value and add '[]', finally it should looks like this:

$fieldset->addField('image', 'image', array(
 'label' => Mage::helper('featuredsalons')->__('Image'),
 'required' => true,
 'multiple' => 'multiple', 
 'name' => 'image[]',
 'after_element_html' => '<p class="note"><span>Image Dimension: </span></p>'
 ));
answered May 14, 2015 at 6:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.