Home > front end >  how to get one or more files in one <input type="file" multiple />
how to get one or more files in one <input type="file" multiple />

Time:03-16

It's confusing to me, I want to get one or more files using an input with multiple attribute.

I have created the following form:

<form method="get">
  <input type="file" name="file" multiple />
  <br /><br />
  <input type="submit" />
</form>

When I select a file and submit the form, at the end of the URL and after the question mark(?) it shows:

?file=fileName.jpg

My problem is that if the user selects two files, they must show both in the URL. Like the following:

?file=fileName.jpg&anotherFileName.jpg

I can actually have more than one file. But no matter how many files I select, it only shows one.

This is not what I'm looking for, it only shows selected photos (enter image description here

CodePudding user response:

<form action="/upload" enctype="multipart/form-data" method="post">
  <input type="file" name="file" multiple>
  <br /><br />
  <button>Submit</button>
</form>

Use post and multipart format to upload files

  • Related