upload multi file to laravel
0
hi i have laravel project and this is my html file <tr> <td>{{trans('language.files')}} </td> <td colspan='2'><input type='file' multiple name='files' class='form-control' required /></td> </tr> as you can see its file as array of files and this is the controller code if($request->files != null) { $i = 0; foreach($request->files as $key=> $file) { if(!empty($image)) { $user_id = $request->user_id; if(!file_exists(storage_path()."/app/public/$user_id")) File::makeDirectory(storage_path()."/app/public/$user_id"); // code to upload file $file[$i] in } $i++; } }