• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is there any other alternate to find file size and restrict it?

 
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody, I am Chaitanya, I am working on a web application, on of the requirement is to upload files to the server. Say a mp3 song. The user has to upload only files less than or equal to 5MB. I can't do this at the client side. This is done at server side using a servlet.

If the user tries to upload a file say 500MB, the request takes so much time. The entire file must be sent to server, then the servlet must check the file size and take a decision.

But in gmail we have a good approach, the page will not be redirected, but the file will be uploaded, I think its AJAX, I don't know exactly.

But here I see a small problem in gmail. Suppose I have selected the files to be uploaded, then while I am writing the mail, what if the power has cut? So the files will be on the server for no use. How to handle such things?

Thank you all in advance. Have a nice day.
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly, have you looked at Apache's file upload library? Maintaining state during a large file transfer is certainly non-trivial, if you were to roll your own you'd have to store state on the client and/or server to determine how far through a file you were, not many HTTP based file uploaders do this.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic