DEV Community 👩‍💻👨‍💻


Posted on • Originally published at

Laravel 8 Image Upload Validation

In this article, we will see how to validate laravel 8 image upload validation. In image upload validation you can add validation using the validate() function of laravel and also you can add multiple image uploads with validation in laravel 8. In laravel 8 many validations are available for image validation, form validation, URL validation, string validation, and much more.

In laravel 8, you can validate an image using the file under validation must be an image (jpg, jpeg, png, bmp, gif, svg, or webp). Also, you can required image validation, size of the image, dimension of the image, etc.

So, Let's, see how to validate the image in laravel 8 and how to validate multiple image uploads in laravel.

public function imageValidation(Request $request)
        'image' => 'required|image|mimes:jpg,png,jpeg|max:2048|dimensions:min_width=100,min_height=100,max_width=500,max_height=500',
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Let's Get Hacking

Join the DEV x Linode Hackathon 2022 and use your ingenuity and creativity to build using Linode.

Join the Hackathon <-