1 year ago

File validation

Posted 1 year ago by paklic9

I have problem with file validation. It doesnt validate. I am not sure, if I am doing it right, because I know, there is more similarly ways to do it. I wasnt using server side validation much, only at registration and in that i was using method validate(request(),[...]) and that works. Can you help me? How to validate the file.

My code:

    $files = $request->file('soubory');
      foreach ($files as $file) {
        $rules = array('file' => 'required|mimes:png,gif,jpeg,txt,pdf,doc');
        $validator = \Validator::make(array('file'=> $file), $rules);
        //upload file

Thanks in advance for help.

Please sign in or create an account to participate in this conversation.