简体   繁体   中英

ajax post upload progress - client side only

I have a form from which users can select 100s of files to upload to my server.

When submitting the form a post request is made to the server which may be 100s of MBs long. I would like the users see a progress bar to see how much they have uploaded.

My question is as follows: is there any way to achieve this in client side JS only? I would much prefer to do it without making a call to a jsp or php file on the server.

We can use ext.js but not jquery.

Many thanks, Hugh

No. Standard HTML <form> uploads don't expose their upload progress to JavaScript, so upload progress scripts have to either:

  1. Have some way to retrieve the status of an upload from the server, and check that periodically
  2. Use a nonstandard method of submitting the upload, such as a Flash or Java application, or by chunking the upload in JavaScript

Some browsers (such as Google Chrome) will unobtrusively display the progress of a <form> upload (eg, in the status bar), but many don't, and there's no way I'm aware of to retrieve that data from within the page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM