type=file - should get the value in array instead of single value valuename

44 Views Asked by At

Here am passing the file value to another page new.jsp. As per attached Snapshot i have multiple of choose file option as number of rows exist per condition. From the below code, i could get the value of the filename(but while saving in DB only the last one is getting saved for all the filename as commmon) but i couldnt get all the file names in array.

Can someone pls guide how to get all the filenames through array. Thanks in Adv. If i get the filenames in array for all the rows in the table , i can split and save each filemname in DB according to each row.

Attaching the snapshot for refernce: Browse column with multiple column for type=file according to the condition. enter image description here

<input type="file" name="file1" id="file1" multiple="multiple"/>


 $('input[type=file]').change(function () {
console.dir(this.files[0]);
var filename = this.files[0]['file1'];
alert(filename);
$.ajax({
        url : "new.jsp",
        data : {filename : filename}, 
        type: 'post',
        success : function(data) 
        {
        }
       }); 
                                 });  
                                 
**new.jsp** Page

<%

String filename = request.getParameter("filename");
System.out.println("newfilename"+filename);
session.setAttribute("filename", filename);

%>
0

There are 0 best solutions below