I am trying to validate file size, which I am trying to upload by a File Upload Control. To validate the size of the file, I am using java script code. But it is throwing run time error. Please somebody help me.
<script language="javascript" type="text/javascript">
function getSize() {
var myFSO = new ActiveXObject("Scripting.FileSystemObject");
var filepath = document.upload.file.value;
var thefile = myFSO.getFile(filepath);
var size = thefile.size / (1024 * 1024);
alert(size + "MB");
}
</script>
Error message : Microsoft JScript runtime error: Automation server can't create object