2
votes

I am working with application written in CakePHP 1.3 (unable to move it to CakePHP 2.0, because of changes that've been made to the core of framework). I am trying to upgrade my form which I use to upload files to application and make it possible to upload multiple files at once. I found that setting 'multiple' option would let me choose more then one file, but while passing 'multiple', or 'multiple'=>'' as an option failed and I assume CakePHP 1.3 just ignores it:

<?php echo $this -> Form -> input('FManager', array('label' => '', 'type' => 'file', 'multiple'=>"")); ?>

<?php echo $this -> Form -> input('FManager', array('label' => '', 'type' => 'file', 'multiple')); ?>

I've tried to create raw without Form helper

        <input  type="file" multiple="" /> 

And that allows me to select multiple so I will just have to fix the logic according to what I will get in $this->data from that multiple file input.

Still I would like to know if its possible to make it the cakephp way, if I did some mistake here, or if anyone knows helper, plugin that would help me in this case?

1

1 Answers

3
votes

I had the same problem, but I did find a way to make the multiple file type work by adding a dot and an empty space after the input name.

Not working:

echo $form->input('files', array(
    'label' => 'Files:',
    'type' => 'file',
    'multiple' => 'multiple',
));

Working:

echo $form->input('files. ', array(
    'label' => 'Files:',,
    'type' => 'file',
    'multiple' => 'multiple',
));