Following is my code in which I am detecting filesize before upload but this document.getElementById('file').files[0]
property is not supported by some browsers. All I wanna do is if on detecting browser doesnot support this property user gets alert of no
else yes
. Kindly let me know how to do this?
var filename = document.getElementById('file').files[0];
if (typeof filename === 'undefined' || filename === false)
{
alert('no');
}
else if(filename && filename.size < 10240) { // 10485760 = 10 MB (this size is in bytes)
alert('yes');
$('#processing-modal').modal('show');
return false;
}