Answer the question
In order to leave comments, you need to log in
How to limit the maximum number of photos per post when uploading in parallel?
For example, it is set by the settings of my program that one post can have no more than 10 photos, for example. In the browser, the user selects a pack, for example 15 photos, and starts uploading them to my server. In the controller, before the download starts, it checks the number of already uploaded photos for this post. If there are less than 10, then skips the photo, if more than 10, then throws an exception. When loading in parallel, a situation arises when 11 photos are loaded. Theoretically, more can be loaded (but did not notice this). What is the best way to write conditions so that you still cannot upload more than 10 pieces? I think it's a fairly common issue. How is it done without bicycles?
Answer the question
In order to leave comments, you need to log in
It makes sense to validate the quantity on the frontend even before uploading files to the site, right before submitting the form, anticipating the situation when the quantity exceeds the specified number. Then the user can be notified that this number has been exceeded without waiting for a response after all files have been uploaded to the server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question