(Added [code]...[/code] tags ~ MOD)

<form action="update.php" method="post" name="form1"  enctype="multipart/form-data">
<input placeholder="Menu" type="file"  id="file" name="support_images[]" multiple accept="image/*" />
<input placeholder="Pictures" type="file"  id="file" name="pic_images[]" multiple accept="image/*" />
<input placeholder="thumb" type="file"  id="file" name="thum_images[]" multiple accept="image/*" />
<input type="submit" value="Submit" class="btn_1" name="submit">
</form>

<?php // update.php
if(!empty($_FILES['support_images']['name'])){
echo "menu set";
}else if(!empty($_FILES['pic_images']['name'])){
echo "pic set";
}if(!empty($_FILES['thum_images']['name'])){
echo "thum set";
}else if(!empty($_FILES['support_images']['name']) && !empty($_FILES['pic_images']['name']) && empty($_FILES['pic_images']['name'])){
echo "menu and pic  set";
}else if(!empty($_FILES['support_images']['name']) && empty($_FILES['pic_images']['name']) && !empty($_FILES['pic_images']['name'])){
echo "menu and thum set";
}else if(empty($_FILES['support_images']['name']) && !empty($_FILES['pic_images']['name']) && !empty($_FILES['pic_images']['name'])){
echo "pic and thum set";
}else {
echo "nothing set";
}
?>

    I don't recall for sure how multiple files work, but with the square-bracket syntax for the input name, I think you'd end up with something like $_FILES['support_images'][0]['name'] for the first file of that type, then $_FILES['support_images'][1]['name'] for the next, and so forth. Therefore you might have to first check if $_FILES['support_images] is empty or set, and then if you want to check the name of each of those, do it in a foreach() loop on that array?

      Write a Reply...