Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8099801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:31:49+00:00 2026-06-05T22:31:49+00:00

Using browser firefox and chrome I have an input file element. <input type=’file’ id=’tempFileInput’

  • 0

Using browser firefox and chrome

I have an input file element.

<input type='file' id='tempFileInput' multiple></input>

Let say I have selected three files for the above file input box (‘tempFileInput’);

OnChange I want to separate three files into three new file input boxes for each file. i.e

<input type='file' id='inputFile_0'></input> 
<input type='file' id='inputFile_1'></input> 
<input type='file' id='inputFile_2'></input>

I’m struggling to achieve this. Any help?

//I have written a small JavaScript snippet towards what I wana achieve.

var index = 0;
function multipleInputBoxes(tempFileInput){
   var divForm = document.getElementById('divForm');
   var numOfFiles = tempFileInput.files.length;

   for(var i=0; i<numOfFiles; i++){
      var newUploader = document.createElement('input');
      newUploader.type='file';
      newUploader.id = 'inputFile_' + index;

      var file = tempFileInput.files[i];
      ***newUploader.files[0] = file;***
      //above line does not work, as by default due to security reasons input type='file' is read only, and non editable.

      divForm.appendChild(newUploader);
      index++;
   }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:31:50+00:00Added an answer on June 5, 2026 at 10:31 pm

    So I was having difficulty accessing file(s) form single fileinput and separately saving them in each form. As I could access each file var file = tempFileInput.files[i], I created a loop and saved each file in a html ‘object’ tag and saved the file object in object.value. For e.g

    var numOfFile = tempFileInput.files.length;
    for (var int i=0; i<numOfFile; i++){
        //get file object from the filinput element
        var file = tempFileInput.files[i];
    
        //create new element
        var newObj = document.createElement('object');
            newObj.id = 'obj_' + i;
            newObj.value = file;
    
        //append object to new form
        createNewForm(newObj);
    }
    
    function createNewForm(newObj){
       ...do something here
       ...
       ...
       newForm.appendChild(newObj);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using input type=file, Now my requirement is that I only want to
I'm using firefox as my default browser for my basic webdev learning process and
I am using IE8 browser. It creates an empty text node after <input /><span><textarea>
I have created a simple web browser using c# and I want to block
I am using Windows 7 and I've been playing with the Firefox browser for
When using a WebKit browser (Chrome or Safari), if I try to get the
I already have this working in Firefox, Safari and Chrome. I would like to
I have the following input element (I deliberately omitted attributes which weren't necessary for
I have a form where the input fields are saved onChange . In Firefox
I've been using $('select[required]').is(':invalid') if the browser supports the pattern attribute if(Modernizr.input.pattern) {} ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.