Here are the inputs I want to loop through
Main photo: Side photo 1:
just rename your fields this way
Main photo: Side photo 1: Side photo 2: Side photo 3:
and then you'll be able to iterate it usual way:
foreach($_FILES as $file){ echo $file['name']; }