Abstract
there is no way to know file size before uploading it to your server.
http://www.yahoomail.com/ uploads file
then check its size if its size exceed 10 MB, yahoo server revokes it in
this way you consuming server's memory and bandwidth.that's a bad deal.
Solution
you have to write some java script code:
<P>function GetSize(file){</P><P>var fso=new ActiveXObject("Scripting.FileSystemObject");</P><P>var f=fso.getFile(file);</P><P>return fso.getFile(file).size;</P><P>}</P>
this function takes file name and returns file size. it uses windows embed
ActiveX to get file size.
then you write another function to do calculations:
function checkFileSize(ctrl){
if(GetSize(ctrl.value)>10485760)
{
alert('Sorry file size > 10MB');
ctrl.form.reset();
}
}
simply it takes Fileupload control reference and call GetSize function
and compare its result to 10485760(10 MB=10485760 B) if the file size exceed 10
MB,it reset form else do nothing and submit form to server.to use this
function put an html button and add this attribute to it
onclick="checkFileSize(this.form.File1);".
Senior Development Manager, with 11 years of experience. Focused on design/developing/delivery B/OSS modules to satisfy customer/business requirements in accordance to TM Forum's TAM/SID framework. Excellent communication and interpersonal skills, flexibility, ability to adjust to new people and situations, strong problem solving skills and willing to work effectively and efficiently. Gained additional leadership skills such as: - High effective mentorship and coaching - Clearly communication and solutions sharing with my team - Decision making