I am uploading multiple photos, where I want to reject photos that are too big, using essentially:
file_upload.php contains:
This works fine if none of my photos are too big. I can detect an individual photo that is too big using $file_size, but if I have too many big photos I get the message in the title. I have found how to increase the limit of 8388608 bytes but I don't want to do this. I just want to abort neatly with a message like "too many big files".
Code:
<form action='file_upload.php' method='POST' enctype='multipart/form-data'>
<input type='file' name='files[]' multiple>
</form>
file_upload.php contains:
Code:
foreach ($_FILES['files']['tmp_name'] as $key => $value)
{
$file_tmpname = $_FILES['files']['tmp_name'][$key];
$file_name = $_FILES['files']['name'][$key];
$file_size = $_FILES['files']['size'][$key];
}
This works fine if none of my photos are too big. I can detect an individual photo that is too big using $file_size, but if I have too many big photos I get the message in the title. I have found how to increase the limit of 8388608 bytes but I don't want to do this. I just want to abort neatly with a message like "too many big files".