?
Solved

how to get file size through javascript without using Activex Object

Posted on 2009-04-23
3
Medium Priority
?
4,751 Views
Last Modified: 2012-08-13
Hi,
   How to get the upload file size through javascript.
I am not using ActiveX object as this object is not supported by all browsers.

<form name="formCompanyLogo" action="companyUpload.jsp" method="post"
      ENCTYPE="multipart/form-data">
<input type="file" name="file" id="submitfileForCompanyLogo" value="browse"  />  <input       name="input" type="submit" id="input" value="Upload"
      onclick="return upLoadLogoImage();" /></form>


plz help me asap...

thnx in advance....
0
Comment
Question by:emsysindia
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
sunithnair earned 750 total points
ID: 24214679
I dont think you will be able to get the file size just by using javascript. ActiveX was one option but since you do not want to use that your only option would be to get the file size after uploading the file to the server using JSP.
0
 
LVL 39

Assisted Solution

by:abel
abel earned 750 total points
ID: 24214688
I'm afraid I have bad news for you: directly, through javascript, is not possible. What you can do, however (similar to the EE upload facility), is using ajax-style technique or using an IFrame (the latter is what is used at EE).

The trick is as follows: the file is uploaded and the server returns a piece of html/xml that contains the filesize. On the server side you can use your regular methods to extract the filesize.
0
 
LVL 39

Expert Comment

by:abel
ID: 24570457
Abandoning a question and then checking back with a lower grade is considered poor behavior on EE. Please reconsider your grade or check back with what you need clarification on.

An answer that something cannot be done should not influence your grading, not even if you are disappointed about the limits of a certain technology. I'm also disappointed that my car cannot fly, but if someone explains me that, is that a bad messenger?

Problems with closing questions? Check this: http://www.experts-exchange.com/help.jsp?hi=407
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question