idwall / idcrop

Polygonal image cropping plugin.
MIT License
18 stars 9 forks source link

Check file type on upload #19

Open brizental opened 6 years ago

brizental commented 6 years ago

Right we have no validation of filetype whatsoever. If the user tries to input a non-image file, the interface crashes.

felquis commented 6 years ago

For this one, you need to add the accept attribute to the <input type="file" here https://github.com/idwall/idcrop/blob/c8e93fbec7ebb8dd37027758f0c6e3261f0ff3ab/lib/js/idcrop/IdCrop.js#L152-L156

Check this doc https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file the Limiting accepted file types section.