0

When I try to upload an image within Laravel the validation is not working. Here my validation string...

'cover' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048'

The validation error I get is The cover must be an image. It does work however when I only have the required rule.

What is the problem?

2
  • 4
    What does your <form> element look like? Are you using enctype="multipart/form-data"? Commented Jul 6, 2018 at 19:21
  • please update your question to include the html Commented Jul 6, 2018 at 21:51

2 Answers 2

1

You can remove the rule 'image' on your validation :

'cover' => 'required|mimes:jpeg,png,jpg,gif,svg|max:2048',

Hope it help u :)

Sign up to request clarification or add additional context in comments.

Comments

0

try this

'cover' => 'required|image|max:2048',

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.