Charmie
Charmie

Reputation: 2610

Cakephp Multiple File Upload

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(); 
?>

Upvotes: 1

Views: 6436

Answers (2)

Aehandasa
Aehandasa

Reputation: 31

Best solution is

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

Upvotes: 2

Charmie
Charmie

Reputation: 2610

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 :)

Upvotes: 1

Related Questions