Validating multiple file uploads with Laravel 4

后端 未结 4 1699
遥遥无期
遥遥无期 2021-02-06 17:22

How do I go about validating an array of uploaded files in Laravel 4? I\'ve set it in the form to allow multiple files, and I\'ve tested that the files exist in the Input::file(

4条回答
  •  离开以前
    2021-02-06 17:36

    foreach(Request::file('photos') as $key => $value) {
        $rules['photos.'.$key]="mimes:jpeg,jpg,png,gif|required|max:10000";
        $friendly_names['photos.'.$key]="photos";
    }
    

    This worked for me in Laravel 5.2

提交回复
热议问题