2013-05-06 66 views
0

我想用cakephp創建一個多文件上傳。但是,我遇到了一個問題,我無法啓用Cake的內置上傳功能的「多個」功能。Cakephp多文件上傳

這裏就是我的了:

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

回答

1

我的錯誤在於,這行代碼:

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

經研究,我能得到正確的,修改了代碼到這一點:

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

得到它的工作:)

1

最佳解決方案是

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

是的。添加一個點'。'像'文件。 '在名稱的末尾顯示所有選中的圖像。 – rahulbehl 2014-12-11 08:23:42