you can use this
<input type="file" id="myfile" accept="image/gif, image/jpeg, image/png, image/jpeg" />
but using this. user can anytime change the filter.
additionally you should use
javascript or jquery to validate.
<script type ="text/javascript">
var validFiles=["bmp","gif","png","jpg","jpeg"];//array of allowed extensions
function OnUpload()
{
var obj = document.getElementById("myfile");
var source=obj.value;
var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
for (var i=0; i<validFiles.length; i++)
{
if (validFiles[i]==ext)
break;
}
if (i>=validFiles.length)
{
alert("This not a valid file upload file with an extention of one of the following:\n\n"+validFiles.join(", "));
return false;
}
return true;
}
</script>