• 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

Show a text until the entire file uploads

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am uploading a csv file with unknown number of lines. I need to show a text like say "Processing Please wait.." until the entire file uploads.
How can i do it? I cannot use any ajax call or so.
 
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I know, there is no JavaScript event that is fired when a file upload completes.

You may need to either use Ajax, or do some bending over using iframes.

It might help to know some details of how you are submitting the multi-part form.
 
Saloon Keeper
Posts: 27889
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HTTP does not "load a file".

What happens is that when you display a form with a type "file" on it, and add the local pathname of a file, then the form submit process will open that file, scoop up its contents, and embed it within a MIME-encoded section of the current HTTP form submit request.

As originally implemented, an HTTP submit was atomic. You couldn't put up a "please wait" message message, because any such action could only be done in the HTTP Response, which was only returned after it was generated from processing the HTTP Request. So by the time you could display "please wait", the file had not only already finished uploading but presumably had been processed by the server application.

Newer implementations of the spec do allow "chunking" of data, but even there, you're still constrained to the strict Request/process/Response lifecycle.

Having said that, I have been using the RichFaces fileupload control and it does display an actual progress bar. I haven't investigated how. My suspicion is that there's AJAX code that puts up the animation, does incremental request/response cycles uploading a fragment of the file for each cycle and updates the UI via client-side javascript between increments. I do know that there's a separate "upload complete" event listener that has to be implemented on the server side. Which means that implementing the process by brute force is probably rather tedious and I'm glad someone else did it for me.

Maybe there's a jQuery component that does that. For that matter, maybe there's a jQuery component that does that and the RichFaces fileupload uses it. It's not impossible.
reply
    Bookmark Topic Watch Topic
  • New Topic