Sorry for the messy code, I'm just a newbie.
How can I separate the error of each file uploaded so that I can make different html code?
switch ( $_FILES['photo']['error'][$key] ) {
case UPLOAD_ERR_NO_FILE:
$photo_errors0[0] = 'No file sent';
$photo_errors1[1] = 'No file sent';
break;
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
$photo_errors0[0] = 'Max file size exceeded!';
$photo_errors1[1] = 'Max file size exceeded!';
break;
default:
$photo_errors0[0] = 'Unknown errors';
$photo_errors1[1] = 'Unknown errors';
break;
}
<?php foreach ($photo_errors0 as $photo_error0):?>
<div class="photo-error"><?php echo htmlspecialchars( $photo_error0 ); ?></div>
<?php endforeach; ?>
<?php foreach ($photo_errors1 as $photo_error1):?>
<div class="photo-error"><?php echo htmlspecialchars( $photo_error1 ); ?></div>
<?php endforeach; ?>