Thursday, 8 August 2013

Get Image File Extension by jQuery

var filename = "picture.jpg";
var valid_extensions = /(\.jpg|\.jpeg|\.gif)$/i;   
if(valid_extensions.test(filename))
{ 
   alert('OK');
}
else
{
   alert('Invalid File');
}
Add this code before submitting the file.

No comments:

Post a Comment