I'm using an upload plugin to upload files in jquery.
This gets the type of the file uploaded (e.g. jpeg):
data.files[0].type
I need to check if it's a valid image file type (usal image file types jpeg, jpeg, gif, png) using a reg expression.
So far I have:
var isValid = (/\.(gif|jpg|jpeg|tiff|png)$/i).test(data.files[0].type);
But it's not working (always returns false).
Any ideas on how to fix?
Thanks