sumwai
(Sumwai Low)
1
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?
oorastard
(Oorastard)
2
Have you tried to use the html options in activeFileField?
http://www.yiiframework.com/doc/api/CHtml#activeFileField-detail
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.
HTH
sumwai
(Sumwai Low)
3
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]
oorastard
(Oorastard)
4
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.