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.

  • If it is enough, you can just add multiple file input fields. Is multiple limited? Or is multiple 0+? – Fabian Blechschmidt Aug 27 '13 at 19:20
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.

|improve this answer|||||
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

|improve this answer|||||
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>'
  ));
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.