You are viewing this page out of context. To see it in the context it is intended please click here.
About This Page
Reply posted by David Schmidt on Mon 23 Jun 2003 in response to Controlling the Size of Uploaded Files
Test the file size from the browser using JScript
There is another way to check the file size through Jscript, using theActiveXobject FileSystemObject.
Regards
David Schmidt
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function getfilesize(filepath)
{
var filesyst=new ActiveXObject('Scripting.FileSystemObject');
var f=filesyst.GetFile(filepath);
s="<b>File Name: </b>"+f.Name+"<br />";
s+= "<b>File Size: </b>"+ f.size+"<br />";
s+= "<b>Path: </b>"+ f.Path.toUpperCase()+"<br />";
s+= "<b>Type: </b>"+ f.Type+"<br />";
s+= "<b>Created: </b>"+ f.DateCreated+"<br />";
s+= "<b>Last Accessed: </b>"+f.DateLastAccessed+"<br />";
s+= "<b>Last Modified: </b>"+f.DateLastModified;
document.all.dspfileprop.innerHTML=s;
}
// -->
</SCRIPT>
</HEAD>
<BODY TEXT="000000" BGCOLOR="FFFFFF">
<FORM METHOD=post ACTION="/david/test.nsf/fileprop?OpenForm&Seq=1"
ENCTYPE="multipart/form-data" NAME="_fileprop">
<INPUT ID="fileupload" onchange=getfilesize(fileupload.value); TYPE=file
NAME="fileupload">
<div id=dspfileprop style="border:1px solid black; padding:5px"></div>
</FORM>
</BODY>
</HTML>