N
N
naneri2014-10-30 14:52:08
JavaScript
naneri, 2014-10-30 14:52:08

How to properly organize a web application for uploading images?

The essence of the application is this - in the folder 'public/images' are images.
When the page is loaded, the controller must load them all at once, then send requests every minute to check whether there are new images in this folder, and if they are, then upload them to the page.

How to properly organize the check for new images?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
TroyashkA, 2014-10-30
@TroyashkA

The controller function should not include such a "periodic" check. If the addition of images cannot be tracked (for example, through the database), then this should be done, for example, by a script on the server. In your case, its task will be to check for updates every minute and notify the site.

B
Boris Lapin, 2015-01-07
@MrBoriska

Without knowing the context, a minute-by-minute check is necessary. It will work like this:
Some script on the server. This script gets the name of all the images in the folder by running on an Ajax request from a client script. In addition, this Ajax request carries POST data with a list of images already uploaded to the client. After generating a list of all images in the folder, the script removes the image names received by POST from it. Those that remain are returned to the client as a response to a request in the form of a name with an extension. The script on the client generates the full path to the image / images, then the tag / tags and adds it / them to the page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question