In your code at the loop:

foreach($uploads as $upload){
#define a “unique” name and a path to where our file must go
$path = ‘temp/’.md5(uniqid(rand(), true)).’-’.strtolower($upload->getname());
 #move the file and simultaneously check if everything was ok
($upload->moveTo($path)) ? $isUploaded = true : $isUploaded = false;
}

What if $isUploaded turns false in one of the loop, and turn true for other loops. When checking the upload sucess at:

#if any file couldn’t be moved, then throw an message
($isUploaded) ? die(‘Files successfully uploaded.’) : die(‘Some error ocurred.’);

Do you think we need to check if file was uploaded at each loop?