add additional open/close bracket to the name of file input field

when using CHtml.activeFileField() it gives me


input type='file' name='Model[filename]'


which is perfect for single file upload, but i want to do multi file upload like this, notice the additional open & close bracket after [filename].


input type='file' name='Model[filename][]' multiple='multiple'


Is there any thing in CHtml I can do set it, or I have to resort to manually code out the tag in HTML myself?

Have you tried to use the html options in activeFileField?

CHtml::activeFileField($model, 'filename', array('multiple'=>'multiple'));

It does allow the selection of multiple files, but have not tested what/how is sent through the post.


Hi, thanks. That only generates

<input type=‘file’ name=‘Model[filename]’ multiple=‘multiple’>

what I was looking for was

<input type=‘file’ name=‘Model[filename][color="#FF0000"][ ][/color]’ multiple=‘multiple’>

Mode[filename][color="#FF0000"][ ][/color] instead of Model[filename]

Correct. Have you checked to see what is sent through the post? If it is a string of comma separated values you can explode them into an array.