How do you loop through $_FILES array?

前端 未结 8 866
陌清茗
陌清茗 2020-11-28 09:56

Here are the inputs I want to loop through

Main photo:   
Side photo 1: 

        
8条回答
  •  旧巷少年郎
    2020-11-28 10:28

    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']; 
    }
    

提交回复
热议问题