I have the question i am posting is sily and asked many times on this forum but no wer the answer posted by others was solved my issue.

my question is i have fieldset of file and need to upload images with multiple so i had used

 $fieldset->addField('optionimage', 'file', array(
        'label'     => $helper->__('Option Image'),
        'required'  => false,
        'name'      => 'optionimage[]',

but i am failed to add multiple the above field

2 Answers 2


By default you cannot do this.
I explained here why is not possible out of the box and how you can make it work.
The explanation is for image inputs but it works the same for image fields.
The idea is that "multiple" is not an allowed attribute for file inputs.
You need to create your won input renderer that extends Varien_Data_Form_Element_File (or Image if you need it for images) and make it allow multiple as attribute.

so your renderer can look like this

class [Namespace]_[Module]_Block_Adminhtml_[Entity]_Helper_Image extends Varien_Data_Form_Element_Image //or _File if you are not uploading images
    //make your renderer allow "multiple" attribute
    public function getHtmlAttributes(){
        return array_merge(parent::getHtmlAttributes(), array('multiple'));

In your edit form add this:

$fieldset->addType('image', '[Namespace]_[Module]_Block_Adminhtml_[Entity]_Helper_Image');

or if you don't want to upload only images

$fieldset->addType('file', '[Namespace]_[Module]_Block_Adminhtml_[Entity]_Helper_File');

and then add your field like this:

    'image',  //or file
            'name'      => 'image[]', //declare this as array. Otherwise only one image will be uploaded
            'multiple'  => 'multiple', //declare input as 'multiple'
            'label'     => Mage::helper('helper_alias')->__('Image'),
            'title'     => Mage::helper('helper_alias')->__('Image'),
            'required'  => true,

you must use jquesy to select multiple images

require(['jquery'], function ($) { $(document).ready(function () { console.log('Custom JavaScript is loaded!'); $("#image").prop("multiple", true); }); });

  • I don't think that's what the question is asking. The other answer uses php with no JS anywhere, so the claim that jquery is required is off the mark. Nov 20, 2023 at 17:35

Your Answer

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

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