Web form allow .jpg upload only

Does any one have a working method / script to only allow files with ending .jpg to be uploaded via web form field?

I am currently using <input type="file" accept=".jpg" class="form-control" id="" name=""> but users still seem to manage to upload .png or .pdf files now end then.

Cheers, Erik

@Erik haven’t used this in a while, and there is some browser compatibility issues, but this may work:

accept=“image/*”

Add this to the <input type=“file” and you can change it to say:

<input type="file" accept="image/bmp, image/jpeg, image/png" />

Cheers,
Aaron