Hi folks,
I'm testing a multiple file upload view, which have this structure:
<!-- ... -->
<form action="index" method="post" enctype="multipart/form-data">
<input type="file" name="files" multiple>
<input type="submit" value="Send File(s)">
</form>
<!-- ... -->
And then, in my controller I have this code to handle the files sent to it:
if($this->request->hasFiles() == true){
foreach($this->request->getUploadedFiles() as $upload){
$path = 'uploads/'.$upload->getname();
$upload->moveTo($path);
}
}
But for some reason the code above only works with one file. When I try to upload more than one file, it goes as normal (no errors or exceptions displayed), but only one file is uploaded.
When I use print_r
to show what getUploadedFiles()
is returning, there is always only one file in the array. But when I inspect the headers sent to it in the browser, there are all files I've choosen in the input.
Is this some kind of bug? For some reason Phalcon can't support HTML5's native multiple file upload? Or its me doing something wrong?