oh the value <input type="hidden" name="MAX_FILE_SIZE" value="10000000"> is file size in bytes I believe.
Main Topics
Browse All TopicsI have a file upload bar for people to upload image. I am looking for a script that can pop up a window warning user that the file selected has file over the maximum file size limit. This script has to check the file size before starting to accept file upload. Is there anyway to do it?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You have to create an ActiceX...Try this out..
1. Make sure you use IE 5.5 and above
2. Just allow activeX by adding that page as trusted site.
<HTML>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
function check()
{
var Objfile = new ActiveXObject("Scripting.F
var fileval = document.form1.TxtFile.VAL
var fist = objfile.getFile(fileval);
var fsize = fist.size;
alert(fsize + " bytes");
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="form1">
<INPUT TYPE="file" NAME="TxtFile">
<INPUT TYPE="button" NAME="ButCheck" VALUE="SIZE" onClick="check();">
</FORM>
</BODY>
</HTML>
Business Accounts
Answer for Membership
by: jrm213jrm213Posted on 2007-10-03 at 07:25:43ID: 20006780
Hi,
No. Javascript cannot access the file system, it is one of the safeguards in place so that people don't write a javascript that is able to "harm" or "gather data from" someones computer.
I believe you can do this:
<input type="hidden" name="MAX_FILE_SIZE" value="10000000">
and if you place that right before your <input type="file"> tag it will not submit if the file is too big.
so would be like
<input type="hidden" name="MAX_FILE_SIZE" value="10000000">
<input type="file" name="myfileinputname"/>
I am not sure if this is cross-browser functionality or only works in some browsers.