So my code should look like this? :
// Upload the images
$count = count($_FILES['file']['name']);
$missingFile = false;
$index = 0;
do {
try {
$upload = new Upload($newPage->root() . DS . '{safeFilename}', array(
'input' => 'file',
'overwrite' => true,
'index' => $index
));
$index++;
} catch(Error $e) {
switch($e->getCode()) {
case Upload::ERROR_MISSING_FILE:
// No more files have been uploaded
$missingFile = true;
break;
// See the Upload class for other error values
}
}
} while($index > $count-1);
// Check if an image has been uploaded at all
if($index === 0) {
$error = 'No file uploaded.';
}
It works but the problem is that it only upload 1 image…