1

I am trying to create a multiple file upload using cakephp. However, I bumped into a problem wherein I could not enable the "multiple" functionality of the built in upload function of cake.

Here's what I got:

<?php
    echo $this->Form->create('Cmt', array('type'=>'file','multiple'=>'multiple'));
    echo $this->Form->file('File');
    echo $this->Form->submit('Upload');
    echo $this->Form->end(); 
?>

2 Answers 2

2

Best solution is

echo $this->Form->file('File. ', array('type'=>'file','multiple'=>'multiple'));
Sign up to request clarification or add additional context in comments.

1 Comment

Yes. Adding a dot '.' like 'File. ' in the end of the name shows all the images selected.
1

My mistake lies in this line of code:

echo $this->Form->create('Cmt', array('type'=>'file','multiple'=>'multiple'));

Upon research, I was able to get the right one and modified my code into this:

<?php
    echo $this->Form->create('Cmt');
    echo $this->Form->file('File', array('type'=>'file','multiple'=>'multiple'));
    echo $this->Form->submit('Upload');
    echo $this->Form->end(); 
?>

got it working :)

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.