Reputation: 233
Is there any way to check if the image code inside it is valid because
some crackers(hackers) can change the extension and play with image info using some applications to trick the website that the type is image while it's not
so is there any way to check if content is an image code ?
Or is there anyway to check against this type of attacks ?
Upvotes: 1
Views: 788
Reputation: 316
For Multiple Images
$validatedData = $request->validate([
'images' => 'required',
'images.*' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048'
]);
Single Image Validation
$validatedData = $request->validate([
'image' => 'required',
'image' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048'
]);
Upvotes: 2