html - How to get value of multiple-file input on change with jQuery? -



html - How to get value of multiple-file input on change with jQuery? -

to value of <input type="file" name="upload"> jquery, utilize $('input').val().

however, using same method value of <input type="file" name="upload[]" multiple> (multiple-file input) returns 1 file, not of them.

is there different way this?

i used code post...

$('input[type=file]').val()

..and added id of each specific file input field. code below gets path input, pulls filename , shows value in different field 2 different file upload fields. if had ton of them, create loop based on code:

$('#file1').change(function(){ // when leave file1 form field var filename1 = $('input[type=file][id=file1]').val().split('\\').pop(); // filename $('#dl_filename1').val(filename1); // , place in dl_filename1 box }); // end alter $('#file2').change(function(){ // when leave file2 form field var filename2 = $('input[type=file][id=file2]').val().split('\\').pop(); // filename $('#dl_filename2').val(filename2); // , place in dl_filename2 box }); // end alter

jquery html input

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -