I need to upload a lot of files to the server from the UI, and it needs to be done at once. There can be a lot of files, for example, 20, and you don’t want to create 20 inputs.

The Internet is full of examples. Here are these. But they use a separate <input for each file, this is unnecessary for me.

 <form action="/someAction" method="post" enctype="multipart/form-data"> Файлы:<br /> <input name="userfile[]" type="file" /><br /> <input name="userfile[]" type="file" /><br /> <input name="userfile[]" type="file" /><br /> <input type="submit" value="Отправить" /> </form> 

I need one input , but I could select at least 100 files in it right away.

It is possible to do this, and with the help of what, and if there is an example of file validation, for example, on the format type, it will be great.

  • 2
    Just try adding a multiple attribute to the field, and format validation can be provided with the accept attribute: <input name="files" type="file" multiple accept="image/*"> - Sergey Gornostaev

1 answer 1

From the comment by @SergeyGornostaev :

Add the multiple attribute to the field, and the format validation can be provided with the accept attribute:

 <input name="files" type="file" multiple accept="image/*">