Answer the question
In order to leave comments, you need to log in
How to display uploaded images on the page as they are uploaded to the server?
Hello. Actually the question is: there is a form for uploading images to the server (to a specified folder). It is necessary that when loading an image on the page, it immediately appears at the bottom. The next image follows it, and so on. The maximum that I could do was display one image that had just been loaded. the next time it was loaded, it changed to the newly loaded image.
Tell me what can be done? Thanks in advance.
Answer the question
In order to leave comments, you need to log in
Just recently Which library should I use to load images and videos?
The nuance of the plugin loads files instantly, so you need to take care of cleaning the directory
Do you want to do this without js?) You need AJAX. When submitting the form, you intercept the event, send an ajax request with the data you need (images can be transmitted through the FormData object), accept all this on the server, do the necessary actions, and send a response (echo) from there with the desired header. For example, you can send an html text containing a new image list element. And finally, add this element to the end of the list using the success property of the ajax request (well, or display an error using the error property)
If you want images to appear on the page in turn, you can send an ajax request for each uploaded file, but then may be loaded out of sequence due to different sizes. To keep everything in order, you need to apply more complex mechanics.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question