file upload

M

Mark Rae

How could I upload files which are less than 100K only?

Easy enough client-side if your client is happy using ActiveX, and their
security settings will permit it. Something like the following (I haven't
tested this, by the way, but it should be enough to show you how to do
it...)

<html>
<head>

<script language="JavaScript">

function getFileSize(pstrFileSpec)
{
var objFS = new ActiveXObject("Scripting.FileSystemObject");
var objFile = objFS.getFile(pstrFileSpec);
alert(objFile.size + " bytes");
}

</script>

</head>

<body>

<form name="frmTest">
<input type="file" name="txtFile">
<input type="button" name="cmdSize" value="File Size"
onClick="getFileSize(document.frmTest.txtFile);">
</form>

</body>

</html>

Alternatively, you'll have to do it server-side...
 
R

Rutger

Mark said:
Easy enough client-side if your client is happy using ActiveX, and their
security settings will permit it. Something like the following (I haven't
tested this, by the way, but it should be enough to show you how to do
it...)

<html>
<head>

<script language="JavaScript">

function getFileSize(pstrFileSpec)
{
var objFS = new ActiveXObject("Scripting.FileSystemObject");
var objFile = objFS.getFile(pstrFileSpec);
alert(objFile.size + " bytes");
}

</script>

</head>

<body>

<form name="frmTest">
<input type="file" name="txtFile">
<input type="button" name="cmdSize" value="File Size"
onClick="getFileSize(document.frmTest.txtFile);">
</form>

</body>

</html>

Alternatively, you'll have to do it server-side...


This is a IE only 'solution'!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top