I have a web app written in Node,js where I want the user to be able to submit his images if they took a set amount of pictures using their mobile phones, e.g. 20 pictures (they cannot submit more or less). I know I can collect an image in html using the following line, but don't quite know how to enforce the only upload if the user has taken x pictures rule.
<input type="file" accept="image/*" capture="user">
Simplest solution
You can get the number of files selected in the input simply from
input.files.length.This code snippet should help you. I have inserted comments in code to clarify it, comments also contain code you should use for a better experience.
If you are not an
ES6person check out the snippet below. Also, check out the Further Reading section at the bottom of this answer.Not familiar with ES6, see this snippet. Comparing both snippets will help you get familiar with ES6.
Further Reading