-1

I am doing this with single files uploads using

<input type="file" name="comment_img1">
<input type="file" name="comment_img2">
<input type="file" name="comment_img3">
<input type="file" name="comment_img4">
<input type="file" name="comment_img5">

However, I am having trouble doing uploading more than one at a time.

For example, I'd like to be able to select a series of images, then upload them to the server, all at once.

It would be great to use a single file input control, if possible.

Does anyone know how to accomplish this? Thanks!

3
  • Directly you can't do multiselect like this. You might check this: blueimp.github.io/jQuery-File-Upload Commented Jun 14, 2017 at 11:33
  • "It would be great to use a single file input control, if possible." - then it would be great if you could type single file input control multiple or similar into google. Commented Jun 14, 2017 at 11:33
  • 2
    Possible duplicate of Multiple file upload in php Commented Jun 14, 2017 at 12:13

4 Answers 4

0

You can't do multiselect with single input without javascript directly.

However, you might consider using a library for this.

https://blueimp.github.io/jQuery-File-Upload/ This one is very powerful.

Sign up to request clarification or add additional context in comments.

Comments

0

i think your question is already answered here: How to upload multiple files using one file input element

Greetings from Germany

1 Comment

You should flag it as a duplicate and add a comment instead of an answer.
0

you can use multiple attribute for input tag

<input type="file" name="images" multiple>

so it will allow you to select multiple files and on the server side you will get an array eg: $_FILES[images]

then you can loop through this array and upload them one by one

if you still have any confusion see this question Multiple file upload in php

Comments

0

You can't select more than one file in a single input file type without using multiple attribute of it.

Use of multiple in input type="file" is more easy in comparison of your code. so just use the following :

<input type="file" name="whatever_you_want[]" multiple="multiple" />

after submit your form data, you will get an array of it like

$_FILES['name_of_your_input_file_type'];

and after that you can use foreach loop to get images in sequence.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.