Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
instead of uploading single image how to upload multiple image

This I have implemented in javascript. So in this if user uploads a image it will display the image and also image name. So here presently i am able to upload single image. So how can we upload multiple images in this case if any one have an idea please let me know

var loadFile = function(event) { 
  var image = document.getElementById('output'); 
  image.src = URL.createObjectURL(event.target.files[0]); 
}
<input type="file" accept="image/*" name="image" id="file" onchange="loadFile(event)">
<img id="output" width="200" />

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use multiple attribute on input to accept multiple images, and use a for loop, to iterate over the files, and display each one of them.

var loadFile = function(event) {
  for (let i = 0; i < event.target.files.length; i++) {
    var image = document.createElement('img');
    image.src = URL.createObjectURL(event.target.files[i]);
    image.id = "output";
    image.width = "200";
    document.querySelector(".cont").appendChild(image);
  }
};
<p><input multiple type="file" accept="image/*" name="image" id="file" onchange="loadFile(event)" style=""></p>
<p class="cont"></p>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!