Javascript Code to Check Filetype is Valid Image

The JavaScript Code Below Checks the The File Selected by the User Is an Image File. For Added Security Make Sure Your File Select Element Enforces

Home Short:

The JavaScript code below checks the the file selected by the user is an image file. For added security make sure your file select element enforces this as well via the ACCEPT attribute ...

<input accept="image/gif,image/png,image/jpeg" id="idOfImageFileControl" name="inputfilephoto" type="file">

S
H
A
R
E