Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

coustas's avatar

image validation rules example

Hello i want to add a validation for image type i am using laravel 5.5 this is my code

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

i upload correct file but always says that the file is not correct type

what i am doing wrong?

0 likes
5 replies
tanmay_das's avatar

In your opening <form> tag, add enctype="multipart/form-data" attribute.

coustas's avatar

i add it but it still the same , i am using angular in front end but add also on headers headers: {enctype:'multipart/form-data'}

coustas's avatar

yes i am using dropzone... i add it is one form basically i want to validate only dimensions but

'banner_url' => 'dimensions:width=336,height=280'

whatever image i add it doesnt let me to pass it... i put correct size still nothing

Please or to participate in this conversation.