Validating multiple file uploads with Laravel 4

后端 未结 4 1698
遥遥无期
遥遥无期 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:45

    It might not be the direct answer for your question, but you can do a simple validation check on types like this:

    $file = Input::file('files');
    
    switch($file->getClientMimeType()){
          case 'application/pdf':
               // upload stuff
          break;
    }
    

提交回复
热议问题