I have a file.svg image and I renamed the file to file.jpg
Now opening this jpg file in the browser definitely would not preview my image. So what i am trying is to detect if the jpg image uploaded via input form is actually jpg within the browser.
I tried reading the file as base64 but couldn't find anything. There is a way to detect if the jpg image is truncated or not here is a reference to that article js check if an image truncated/corrupted data
How can I detect if the image is of correct type as is the extension ?