3

I have laravel project that let user upload images and I can validate (jpeg/png) without problem. the problem occur when users upload JFIF-image (which consider to be images/jpeg mime types) but the laravel intervention package show message "Encoding format (jfif) is not supported." so, how to detect jfif during validation to prevent this. I tried:

$request->file('image')->extension() //return jpeg

1 Answers1

0

You should be able to get the extension using

$request->file('image')->getClientOriginalExtension()

Note that this function makes use of the pathinfo() function and so is based on the file name as per the comment on the source code

Helioarch
  • 1,158
  • 5
  • 18