svsameer
03-14-2005, 05:40 AM
I am trying to restrict user by not uploading very heavy file so to get file size i hv written following code
but it gives me error i.e. file2.fileSize is null or not an obejct
========================================
<script language=javascript>
var b="";
function callme()
{
var a=document.f1.t1.value;
b=document.f1.f1.value;
var file2 = document.f1.f1.value;
alert (file2)
var fs =new ActiveXObject("Scripting.FileSystemObject");
//alert (fs.file2.size)
alert (fs.file2.fileSize)
fs = null
window.alert(a+" you hv selected "+b)
}
</script>
<form name=f1>
Name : <input type=text name=t1><br>
<input type=file name=f1><br>
<input type=button name=b1 value="Upload" onclick=callme()><br>
<input type=submit>
</form>
========================================
Sameer
but it gives me error i.e. file2.fileSize is null or not an obejct
========================================
<script language=javascript>
var b="";
function callme()
{
var a=document.f1.t1.value;
b=document.f1.f1.value;
var file2 = document.f1.f1.value;
alert (file2)
var fs =new ActiveXObject("Scripting.FileSystemObject");
//alert (fs.file2.size)
alert (fs.file2.fileSize)
fs = null
window.alert(a+" you hv selected "+b)
}
</script>
<form name=f1>
Name : <input type=text name=t1><br>
<input type=file name=f1><br>
<input type=button name=b1 value="Upload" onclick=callme()><br>
<input type=submit>
</form>
========================================
Sameer