fb_pixel

Javascript: how in IE to get the file size in input type = 'file' before starting the download?

Development | Web Development
Description
How in IE to get the file size in input type='file'before starting the download? Are there any sane methods?

Attachments
No attachments
Info
Description
Look at:

function A()
{
var oas = new ActiveXObject("Scripting.FileSystemObject");
var d = document.a.b.value;
var e = oas.getFile(d);
var f = e.size;
alert(f + " bytes");
}
</script>
</head>
<body>
<form name="a">
<input type="file" name="b">
<input type="button" name="c" value="SIZE" onClick="A();">
</form>
</body>
</html>


or

function imgLoad()
{
var strT = new String();
document.getElementById("ShowImg").innerHTML= "";
strT = document.ModReg.file1.value;
if(strT != "")
{
    strT = "<img id='Sample' src='" + strT + "' width='100' height='100'></img>";
    document.getElementById("ShowImg").innerHTML= strT;
    if(!LimitedSize())
    {
       alert("File Size is more than 100 KB");
       document.getElementById("ShowImg").innerHTML= "";
    }
}
}
 
function LimitedSize()
{
var i;
var y = document.images;
for (i=0;i<y.length;i++)
{
    if((y[i].id) == 'Sample')
    { 
      if(y[i].fileSize > 102400)
          return false;
    }
}
return true;
}
 

on January 07th, 2020 (9:05 pm)
All coments
This job has not been commented yet.