Ideas on getting files on the UI


#1

In the following scenario, I am wondering what would be the best way to get the files from the server.

I’ve a download button in the UI, the user clicks on it, it could take 2-3 hours for the backend to process upload the files(3-4 files) in a specific directory on the server.

  1. What would be an ideal way to display files on the UI. I mean how should I get it from the specified directory from the server. Since there are 2-3 files that I am trying to get, I am wondering how making a web service call to the specified location would make sense since a REST call might just give me a JSON or XML response? Is there any other approach that I am missing here?

  2. For displaying a file, would showing a HTML text area and then showing the files in it be a good idea?I am not sure if this is even possible or if it’s a correct approach. The user should be able to download all the files in zip format.

Thanks


#2

Email


#3

Sorry, I didn’t understand.


#4

He’s saying if you expect a 2-3 HOUR lag time between the user clicking a button and the file being available, it’s best to notify and/or send the user the file (or link) via email, because noone’s going to sit there with a spinning pinwheel for 2-3 hours.

Basically, establish a simple Job Queue system: (Some of this functionality may be overkill/undesired, but for the purposes of description, are included)
User clicks button.
Server receives button click, begins processing files.
Server simultaneously responds to the user, informing the browser that it has received the request, and giving it a Job ID number.
User is now free to do whatever they want while the server processes.
During processing time, User can query the server for the status of the Job based on ID number.
Once the job is completed, Server issues an email to the user notifying them.
User can now query the server for the status of the Job using the ID number, and be given the files in question.


#5

I see. For 2-3 hour delay, I am handling such issue using Java Message Service (JMS). With JMS I am able to handle asynchronous requests. Email is the thing I am trying to figure out as well.

By any chance you have any idea about how should I get the files once it’s there on the server. Thanks


#6

This is right. I’ve already talked about this before.

https://www.sitepoint.com/community/t/is-there-an-alternative-to-ajax-in-the-following-scenario/320509/8?u=mawburn

A system I am rewriting does something similar. It was solved by sending the reports to the user’s email because the reports are very time consuming. There is no need for a heartbeat or websocket because the data is handled outside the web client.


#7

Right. But here I am trying to figure out about retrieving files. I mean let’s say user returns after 2-3 hours and then clicks on download button, he/she should immediately get the files since the files are already present on the server at specified location. So, this is the part where I am trying to get some ideas.


#8

Store them as a key name and let the user download them from wherever you’re storing them. There’s not really anything to that.


#9

Thanks. I am wondering what would be the best approach to download the file using jQuery or HTML5 download attribute since I need to download 3 files in a zipped format.

Somewhat similar to what they have done here :

Not sure how they are doing that. Since I have 3 files, I would want them to be in zip format.

Thanks


#10

By key name, were you referring to current timestamp or something unique identifier? If I decide to store it using current timestamp, would it be possible to retrieve it easily at the time of download?