<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>RE: Javascript Digest, Vol 25, Issue 5</TITLE>

<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=891050610-08032005><FONT face=Arial color=#0000ff size=2>Hi 
</FONT></SPAN></DIV>
<DIV><SPAN class=891050610-08032005><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=891050610-08032005><FONT face=Arial color=#0000ff size=2>As 
everyone been mentioning doing this with javascript on his own not going to 
work.</FONT></SPAN></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=891050610-08032005>But what you are trying to do might work if you include 
an Active X into your page and call </SPAN>t<SPAN 
class=891050610-08032005>he&nbsp;method of this active X in the page I saw an 
examples once of exactly what you want to do in an upload example from a site 
who sell there component for the server, Sorry can't put my hand on it 
anymore.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=891050610-08032005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=891050610-08032005>This tool might interest you however is not free. But 
sometime paying a small fee might save you hours of endless 
coding.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=891050610-08032005><A 
href="http://www.aspupload.com/xupload.html">http://www.aspupload.com/xupload.html</A></SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=891050610-08032005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=891050610-08032005>Laurent</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=891050610-08032005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=891050610-08032005>&nbsp;</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=891050610-08032005></SPAN><SPAN 
class=891050610-08032005>&nbsp;</SPAN></FONT></FONT></FONT><FONT face=Tahoma 
size=2>-----Original Message-----<BR><B>From:</B> Abhishek_Ghosh 
[mailto:Abhishek_Ghosh@satyam.com]<BR><B>Sent:</B> 07 March 2005 
18:52<BR><B>To:</B> javascript@LaTech.edu<BR><B>Subject:</B> [Javascript] RE: 
Javascript Digest, Vol 25, Issue 5<BR><BR></DIV></FONT>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <P><FONT size=2>Paul,</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  <FONT size=2>In my application the user can upload 5 files at the same time 
  whose collective size should not exceed 20MB and to check this on the server 
  side still incurs a lot of cost on the band width, which I intend to reduce. 
  The idea of having a client side validation with the size gives the privilege 
  to alert the user that the size has exceeded the limit and the request cannot 
  be processed any further.</FONT></P>
  <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>Java Script is 
  anyway a client side programming language. So I believe that file handling may 
  be a proposition available with it. In this regard I stumbled on this code 
  piece but still the browser cannot identify the File as a class.</FONT></P>
  <P><FONT size=2>Richard,</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  <FONT size=2>The link that you have given to me also talks about the same File 
  class, but I could not find any clue how to bring it to use. However the 
  fileSizeChecker is not a document property but the name of the file type input 
  field on the JSP code that takes the full file path as the resolved input. On 
  property change of this field the appropriate method is called to find the 
  file size.</FONT></P>
  <P><FONT size=2>The problem still stands its ground. Can anyone provide me 
  some update of how to use the File class on an IE browser on a Windows 
  operating system.</FONT></P>
  <P><FONT size=2>Thanx in advance</FONT> </P>
  <P><FONT size=2>------------------------------------------------------- 
  </FONT><BR><FONT size=2>Regards, </FONT><BR><FONT size=2>Abhishek Ghosh 
  </FONT><BR><FONT size=2>GEPS, GE-GDC, Satyam Computer Services Limited 
  </FONT><BR><FONT size=2>Satyam Technology Centre, </FONT><BR><FONT 
  size=2>Hyderabad - 500043 </FONT><BR><FONT size=2>Phone : (O)+91 40 55233562 
  (Extn-3062) </FONT><BR><FONT 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  (R)+91 40 55233562 (Extn-2756) </FONT><BR><FONT size=2>Mobile : +91 94408 
  77249 </FONT><BR><FONT size=2>e-mail : Abhishek_Ghosh@satyam.com 
  </FONT><BR><FONT size=2>Web : www.satyam.com </FONT></P><BR>
  <P><FONT size=2>-----Original Message-----</FONT> <BR><FONT size=2>From: 
  javascript-bounces@LaTech.edu [<A 
  href="mailto:javascript-bounces@LaTech.edu">mailto:javascript-bounces@LaTech.edu</A>] 
  </FONT><BR><FONT size=2>Sent: Monday, March 07, 2005 1:00 PM</FONT> <BR><FONT 
  size=2>To: javascript@LaTech.edu</FONT> <BR><FONT size=2>Subject: Javascript 
  Digest, Vol 25, Issue 5</FONT> </P>
  <P><FONT size=2>Send Javascript mailing list submissions to</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  size=2>javascript@LaTech.edu</FONT> </P>
  <P><FONT size=2>To subscribe or unsubscribe via the World Wide Web, 
  visit</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2><A 
  href="https://lists.LaTech.edu/mailman/listinfo/javascript" 
  target=_blank>https://lists.LaTech.edu/mailman/listinfo/javascript</A></FONT> 
  <BR><FONT size=2>or, via email, send a message with subject or body 'help' 
  to</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  size=2>javascript-request@LaTech.edu</FONT> </P>
  <P><FONT size=2>You can reach the person managing the list at</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  size=2>javascript-owner@LaTech.edu</FONT> </P>
  <P><FONT size=2>When replying, please edit your Subject line so it is more 
  specific</FONT> <BR><FONT size=2>than "Re: Contents of Javascript 
  digest..."</FONT> </P><BR>
  <P><FONT size=2>Today's Topics:</FONT> </P>
  <P><FONT size=2>&nbsp;&nbsp; 1. Finding file size using java script 
  (Abhishek_Ghosh)</FONT> <BR><FONT size=2>&nbsp;&nbsp; 2. Re: Finding file size 
  using java script (Peter-Paul Koch)</FONT> <BR><FONT size=2>&nbsp;&nbsp; 3. 
  Re: Finding file size using java script (Richard Lewis)</FONT> </P><BR>
  <P><FONT 
  size=2>----------------------------------------------------------------------</FONT> 
  </P>
  <P><FONT size=2>Message: 1</FONT> <BR><FONT size=2>Date: Mon, 7 Mar 2005 
  18:50:03 +0530 </FONT><BR><FONT size=2>From: Abhishek_Ghosh 
  &lt;Abhishek_Ghosh@satyam.com&gt;</FONT> <BR><FONT size=2>Subject: 
  [Javascript] Finding file size using java script</FONT> <BR><FONT size=2>To: 
  javascript@LaTech.edu</FONT> <BR><FONT size=2>Message-ID: 
  &lt;A44765C986F8D411995B00B0D0795F4B3B68A627@hhtnt002&gt;</FONT> <BR><FONT 
  size=2>Content-Type: text/plain; charset="us-ascii"</FONT> </P>
  <P><FONT size=2>Hi,</FONT> </P>
  <P><FONT 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I am 
  working on jsp's and have an issue in uploading files. I am</FONT> <BR><FONT 
  size=2>allowed to upload at the max of 20MB on the server, but the issue is 
  often</FONT> <BR><FONT size=2>user ignores the message and tries to upload 
  more than 20MB. The request</FONT> <BR><FONT size=2>goes to the server and the 
  server then throws an error message. This process</FONT> <BR><FONT 
  size=2>however takes some time to get executed. I would like to have a client 
  side</FONT> <BR><FONT size=2>validation done for the size of the file. To do 
  this I cannot use ActiveX</FONT> <BR><FONT size=2>objects as the business 
  requirements strictly restricts use of ActiveX</FONT> <BR><FONT 
  size=2>Objects. The other option is to use the following code :</FONT> </P>
  <P><FONT size=2></FONT> </P>
  <P><FONT 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  var fileObj =</FONT> <BR><FONT 
  size=2>document.fileSizeChecker.fileUpload.value;</FONT> </P>
  <P><FONT 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  var myFile = new</FONT> <BR><FONT 
  size=2>File(document.fileSizeChecker.fileUpload.value);</FONT> </P>
  <P><FONT 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  myFile.open("r");</FONT> </P>
  <P><FONT size=2>alert('myFile length: ' + myFile.getLength());</FONT> </P>
  <P><FONT size=2></FONT> </P>
  <P><FONT 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  Using the above code produces the following javascript error</FONT> <BR><FONT 
  size=2>"'File' is undefined". Please suggest how to bail out of this error or 
  an</FONT> <BR><FONT size=2>alternate method of achieving the purpose.</FONT> 
  </P>
  <P><FONT 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  Thanx in advance.</FONT> </P>
  <P><FONT size=2>------------------------------------------------------- 
  </FONT><BR><FONT size=2>Regards, </FONT><BR><FONT size=2>Abhishek Ghosh 
  </FONT><BR><FONT size=2>GEPS, GE-GDC, Satyam Computer Services Limited 
  </FONT><BR><FONT size=2>Satyam Technology Centre, </FONT><BR><FONT 
  size=2>Hyderabad - 500043 </FONT><BR><FONT size=2>Phone : (O)+91 40 55233562 
  (Extn-3062) </FONT><BR><FONT 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  (R)+91 40 55233562 (Extn-2756) </FONT><BR><FONT size=2>Mobile : +91 94408 
  77249 </FONT><BR><FONT size=2>e-mail : Abhishek_Ghosh@satyam.com 
  </FONT><BR><FONT size=2>Web : www.satyam.com </FONT></P>
  <P><FONT size=2></FONT> </P>
  <P><FONT 
  size=2>************************************************************************** 
  </FONT><BR><FONT size=2>This email (including any attachments) is intended for 
  the sole use of the</FONT> <BR><FONT size=2>intended recipient/s and may 
  contain material that is CONFIDENTIAL AND</FONT> <BR><FONT size=2>PRIVATE 
  COMPANY INFORMATION. Any review or reliance by others or copying or</FONT> 
  <BR><FONT size=2>distribution or forwarding of any or all of the contents in 
  this message is</FONT> <BR><FONT size=2>STRICTLY PROHIBITED. If you are not 
  the intended recipient, please contact</FONT> <BR><FONT size=2>the sender by 
  email and delete all copies; your cooperation in this regard</FONT> <BR><FONT 
  size=2>is appreciated.</FONT> <BR><FONT 
  size=2>**************************************************************************</FONT> 
  <BR><FONT size=2>-------------- next part --------------</FONT> <BR><FONT 
  size=2>An HTML attachment was scrubbed...</FONT> <BR><FONT size=2>URL: <A 
  href="http://lists.LaTech.edu/pipermail/javascript/attachments/20050307/2af58136/attachment-0001.html" 
  target=_blank>http://lists.LaTech.edu/pipermail/javascript/attachments/20050307/2af58136/attachment-0001.html</A></FONT> 
  </P>
  <P><FONT size=2>------------------------------</FONT> </P>
  <P><FONT size=2>Message: 2</FONT> <BR><FONT size=2>Date: Mon, 7 Mar 2005 
  15:37:32 +0100</FONT> <BR><FONT size=2>From: Peter-Paul Koch 
  &lt;pp.koch@gmail.com&gt;</FONT> <BR><FONT size=2>Subject: Re: [Javascript] 
  Finding file size using java script</FONT> <BR><FONT size=2>To: "[JavaScript 
  List]" &lt;javascript@latech.edu&gt;</FONT> <BR><FONT size=2>Message-ID: 
  &lt;21e4a128050307063740a5d0c@mail.gmail.com&gt;</FONT> <BR><FONT 
  size=2>Content-Type: text/plain; charset=US-ASCII</FONT> </P>
  <P><FONT 
  size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  I am working on jsp's and have an issue in uploading files. I am</FONT> 
  <BR><FONT size=2>&gt; allowed to upload at the max of 20MB on the server, but 
  the issue is often</FONT> <BR><FONT size=2>&gt; user ignores the message and 
  tries to upload more than 20MB. The request</FONT> <BR><FONT size=2>&gt; goes 
  to the server and the server then throws an error message. This process</FONT> 
  <BR><FONT size=2>&gt; however takes some time to get executed. I would like to 
  have a client side</FONT> <BR><FONT size=2>&gt; validation done for the size 
  of the file. </FONT></P>
  <P><FONT size=2>That is not possible. JavaScript cannot access files on the 
  users'</FONT> <BR><FONT size=2>computer (or, indeed, any files except for HTML 
  pages). Don't know</FONT> <BR><FONT size=2>about ActiveX, but you said you 
  can't use that anyway.</FONT> </P>
  <P><FONT size=2>The best you can do is find the file size as soon as the user 
  starts</FONT> <BR><FONT size=2>uploading, and abort the uploading an display 
  an error message when</FONT> <BR><FONT size=2>the file size is above 20 M. I 
  *think* that the size of the file is</FONT> <BR><FONT size=2>sent to the 
  server pretty early in the upload process.</FONT> </P>
  <P><FONT size=2>I have no idea how to do that, though. Maybe a Java programmer 
  can</FONT> <BR><FONT size=2>give you some more advice.</FONT> </P>
  <P><FONT size=2>-- </FONT><BR><FONT 
  size=2>-------------------------------------------------------------------</FONT> 
  <BR><FONT size=2>ppk, freelance web developer</FONT> </P>
  <P><FONT size=2>Bug Report: Report bugs yourself, or comment on previously 
  </FONT><BR><FONT size=2>reported ones.</FONT> <BR><FONT size=2><A 
  href="http://www.quirksmode.org/bugreports/" 
  target=_blank>http://www.quirksmode.org/bugreports/</A></FONT> <BR><FONT 
  size=2>------------------------------------------------------------------</FONT> 
  </P><BR>
  <P><FONT size=2>------------------------------</FONT> </P>
  <P><FONT size=2>Message: 3</FONT> <BR><FONT size=2>Date: Mon, 07 Mar 2005 
  14:35:16 +0000</FONT> <BR><FONT size=2>From: "Richard Lewis" 
  &lt;richardlewis@fastmail.co.uk&gt;</FONT> <BR><FONT size=2>Subject: Re: 
  [Javascript] Finding file size using java script</FONT> <BR><FONT size=2>To: 
  "[JavaScript List]" &lt;javascript@LaTech.edu&gt;</FONT> <BR><FONT 
  size=2>Message-ID: 
  &lt;1110206116.7837.216734042@webmail.messagingengine.com&gt;</FONT> <BR><FONT 
  size=2>Content-Type: text/plain; charset="ISO-8859-1"</FONT> </P>
  <P><FONT size=2>On Mon, 7 Mar 2005 18:50:03 +0530 , "Abhishek_Ghosh"</FONT> 
  <BR><FONT size=2>&lt;Abhishek_Ghosh@satyam.com&gt; said:</FONT> <BR><FONT 
  size=2>&gt; Hi,</FONT> <BR><FONT size=2>&gt;</FONT> <BR><FONT 
  size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  I am working on jsp's and have an issue in uploading files. I am allowed to 
  upload at the max of 20MB on the server, but the issue is often user ignores 
  the message &gt;and tries to upload more than 20MB. The request goes to the 
  server and the server then throws an error message. This process however takes 
  some time to get executed. I &gt;would like to have a client side validation 
  done for the size of the file. To do this I cannot use ActiveX objects as the 
  business requirements strictly restricts use of ActiveX &gt;Objects. The other 
  option is to use the following code :</FONT></P>
  <P><FONT size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var fileObj = 
  document.fileSizeChecker.fileUpload.value;</FONT> <BR><FONT 
  size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var myFile = new 
  File(document.fileSizeChecker.fileUpload.value);</FONT> <BR><FONT 
  size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; myFile.open("r");</FONT> <BR><FONT 
  size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert('myFile length: ' + 
  myFile.getLength());</FONT> </P>
  <P><FONT 
  size=2>&nbsp;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  Using the above code produces the following javascript error "'File' is 
  undefined". Please suggest how to bail out of this error or an alternate 
  method of achieving the &gt;purpose.</FONT></P>
  <P><FONT size=2>File is undefined because there is not a File class in 
  standard</FONT> <BR><FONT size=2>JavaScript (yet, see <A 
  href="http://www.mozilla.org/js/js-file-object.html" 
  target=_blank>http://www.mozilla.org/js/js-file-object.html</A>).</FONT> 
  <BR><FONT size=2>Also, I don't think that 'document' has such a property 
  as</FONT> <BR><FONT size=2>fileSizeChecker either.</FONT> </P>
  <P><FONT size=2>And there isn't really a way that your browser can be given 
  permission</FONT> <BR><FONT size=2>to fiddle around with local files. What you 
  can do is use the 'accept'</FONT> <BR><FONT size=2>attribute of the 'input 
  type="file"' tag to restrict the MIME types of</FONT> <BR><FONT size=2>files 
  which can be uploaded but thats about it.</FONT> </P>
  <P><FONT size=2>Cheers,</FONT> <BR><FONT size=2>Richard</FONT> 
</P><BR><BR><BR>
  <P><FONT size=2>------------------------------</FONT> </P>
  <P><FONT size=2>_______________________________________________</FONT> 
  <BR><FONT size=2>Javascript mailing list</FONT> <BR><FONT 
  size=2>Javascript@LaTech.edu</FONT> <BR><FONT size=2><A 
  href="https://lists.LaTech.edu/mailman/listinfo/javascript" 
  target=_blank>https://lists.LaTech.edu/mailman/listinfo/javascript</A></FONT> 
  </P><BR>
  <P><FONT size=2>End of Javascript Digest, Vol 25, Issue 5</FONT> <BR><FONT 
  size=2>*****************************************</FONT> <BR><FONT 
  size=2>************************************************************************** 
  </FONT><BR><FONT size=2>This email (including any attachments) is intended for 
  the sole use of the intended recipient/s and may contain material that is 
  CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others 
  or copying or distribution or forwarding of any or all of the contents in this 
  message is STRICTLY PROHIBITED. If you are not the intended recipient, please 
  contact the sender by email and delete all copies; your cooperation in this 
  regard is appreciated.</FONT></P>
  <P><FONT 
  size=2>**************************************************************************</FONT> 
  </P></BLOCKQUOTE></BODY></HTML>