Solved

Get file size before upload begins

Posted on 2007-04-09
5
2,908 Views
Last Modified: 2013-11-21
Hello Friends,
I want to throw an error immediately if user is trying to upload a file of size greater than the specified limit. We are checking content-Length for this.

If Im not mistaken, for large files the issue is because of the behaviours of HTML and Java: Once the user hits on upload button, the file is included in the request body as the enctype is multipart/form-data. If the connection is slower [this application can be used over internet from user being anywhere in the world] the time taken for a file >10 MBs is considerable.

By the time the whole request is prepared and sent to the server, a lot of time elapses. Then the method you have specified can be called on the fileItem.

If the user is trying to upload a file way above the limit, like of 50MB or 100MB, then the time taken to reach till the point error gets thrown increases.

As of now we are experiencing delays in giving the size limit error message to user like the following- 10MB file ~ 10minutes. 33 MB file ~ 30 minutes and so on.

What can we do for improving this? Or is there any way to get the file size before even the upload begins?

rahulak
0
Comment
Question by:rahulak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 11

Accepted Solution

by:
Manish earned 43 total points
ID: 18897001
0
 
LVL 7

Assisted Solution

by:Chandan_Gowda
Chandan_Gowda earned 41 total points
ID: 18936768
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 41 total points
ID: 19041967
most servers start the application (wether in Java or any other language) right *after* it completed to read the hole request.
Hence it's a more or less useless attempt to check the size in the application for performance/bandwidth issues, obviously.
If your server passes the connection to your application right away, then you can read the content-Length header yourself and decide what to do.But keep in mind that ther must not be such a header if the client sends the data using Connection:close. In that case you have to read data 'til your limit.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
printf performancy 11 105
incorrect syntax near the order by 10 79
SQL Server Database Inventory 7 30
COM server issue 2 29
As a financial services provider, your business is impacted by two of the strictest federal regulations on record: the Sarbanes-Oxley Act and the Gramm-Leach-Bliley Act. Correctly implementing faxing into your organization to provide secure, real-ti…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

751 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