<form id="myForm" enctype="multipart/form-data" method="POST"
onSubmit="return form_submit();">
<input type="file" name="myfile" id="myfile_main" />
</Form>
Javascript
$("#file_change").change(function(){
var file=this.files;
var obj=$.parseJSON(file);
alert(JSON.stringify(this.files));
});
I am trying to set values from file multifile input (file_change) to a single file (myfile),
my main motive is to select multiple file and upload one by one by self.
I am getting error while setting the each value from multifile input to single file input.
I had tried $.each but not getting any idea about how to set the value in input type file (myfile).
It is not possible to programatically select files into a an
<input type="file" />
. The reason for this is security. Consider if it was possible - it would mean that unscrupulous developers could essentially steal files from visitors computers by using Javascript to select a file and submit the form without the user knowing.