i want to check the file array is empty or not ? i am using the multiple file selection of input type file. here is my code.

 <input type="file" name="images[]"  class="form-control" multiple />

       if(empty($_FILES['images']['name'])){
            $this->images='image not selected';
          }else{
          foreach ($_FILES['images']['name'] as $key => $value) {
                $imageExt=explode('/', $_FILES['images']['type'][$i]);
                move_uploaded_file($_FILES['images']['tmp_name'][$i],'./public/images/'.$this->user_id.'_'.$i.'.'.$imageExt[1]);
                $imgArray[]= $this->user_id.'_'.$i.'.'.$imageExt[1];
                $i++;
              }
              $imgString=implode(',', $imgArray);
              $this->images=$imgString;
          }

please help me to correct this. thanks in advance.

0 Answers