How to get input value of multiple files when changing using jQuery?
I used the code from another post ...
$('input[type=file]').val() .. and added the identifier of each input field of a specific file. The code below gets the path from the input, pulls out only the file name from it and displays this value in another field for two different file upload fields. If you had a lot of them, you can create a loop based on this code:
$('#File1').change(function(){ // when you leave the File1 form field var filename1 = $('input[type=file][id=File1]').val().split('\\').pop(); // get just the filename $('#DL_Filename1').val(filename1); // and place it in the DL_Filename1 box }); // end change $('#File2').change(function(){ // when you leave the File2 form field var filename2 = $('input[type=file][id=File2]').val().split('\\').pop(); // get just the filename $('#DL_Filename2').val(filename2); // and place it in the DL_Filename2 box }); // end change