I've an application where I need to check file size whether it is less than or equal to 1MB. For that I am writing a javascript function given as below--
function getFileSize1()
{
var myFSO = new ActiveXObject("Scripting.FileSystemObject");
var filepath = document.form1.attachment.value;
var error="";
if(filepath=="")
return error;
else
{
var selectedfile = myFSO.getFile(filepath);
var size = selectedfile.size;
if(size >= 1048576)
{
error="File size of First Attachment should be less than or Equal to 1 MB \n";
}
return error;
}
}
The above code runs in IE6, But it doesn't work with IE9, Mozila latest version and Chome. Can anybody tell what to do to run the above code in all browser?