Discussion:
[Dojo-interest] Download file from server progress...
karozans
2015-01-27 21:34:07 UTC
Permalink
Hi everyone.

I created a RestFUL method using JAX-RS that gets a file to download from
the server to the client.

I need to generate the file from a database dump so sometimes this file can
take a minute or 2 to generate before it is ready to response to the client.

I don't think I can use AJAX to download the file, right?

Is there a way that I can show a DOJO progress bar while the customer is
waiting for their file to download?

Is there a good way to do this?



--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Download-file-from-server-progress-tp4005126.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

Dojo-***@mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
karozans
2015-01-27 21:56:23 UTC
Permalink
Okay thanks. That's what I thought but I was just double checking.

Thanks.



--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Download-file-from-server-progress-tp4005126p4005129.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

Dojo-***@mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
mc007
2015-01-28 15:52:49 UTC
Permalink
Hi again,
I just toyed with a PHP stream listener, its definitely possible!

This how it works:
1. tag the download with an id
2. make the download going through PHP/Node.js (see for PHP here:
https://github.com/thephpleague/flysystem/issues/23 : last code)
2. store the stream progress somewhere on the server
3. on the client: long-poll the server for that download id
4. create fake progress bar and update it with your long-poll download
status (that's not smooth)

and to make it smooth:

determine periodically the interpolate factor for the progress bar, you will
need a few samples (download-status) to determine the speed. that's very
similar to calculating estimated positions of players in networked games.

never say never







-----
PHP based file manager powered by Dojo toolkit
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Download-file-from-server-progress-tp4005126p4005143.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

Dojo-***@mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Loading...