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

144
Views
remove / add files dynamically to upload field

I have this input field for file upload:

<input onchange="getFiles()" type="file" name='files[]' id="customFile" multiple />

On click I can seelct multiple files for upload. Onchange the function getFiles starts:

function getFiles() {
   console.log( $('#customFile').get(0).files )
}

which shows me this result:

enter image description here

This are my two example files. But If I forgot a file for upload I would be able to add this file with a new upload process. Problem is, if I click again on my upload field and select the forgotten file, it will override the other 2 selected files bevor.

In my "FileList" will only be the last selected. Is there a way to add one file instead to select all 3 files again for upload?

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

0

You might want to save previously uploaded files in local array and push to it inside "getFiles" event handler. Something like this:

const uploadedFiles = [];
function getFiles() {
  uploadedFiles.push(...$('#customFile').get(0).files);
}

It might also be a good idea to refer to file input using "this" con

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!