[Previous Problem Solved]
I downloaded an image upload script which works with Ajax and jQuery. I want to limit the max upload to 8 images only. Please help.
Downloaded From: http://www.phpgang.com/how-to-upload-multiple-images-jquery-ajax-using-php_453.html
Count all files and check there if files are more than 8 or not if there are more than 8 send a message and exit ;
something like this
$fileCount = count($_FILES["myfile"]['name']);
if($fileCount>8){
$data['code'] = "failed";
print_r(json_encode($data));exit;
}
and in your ajax do whatever you want to do ..
Try Something like this.
$allfiles = count($_FILES);
if($allfiles > 8)
{
echo "Sorry You can Upload Only 8 images";
}
else{
//your code here
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.