Get input type file value in jQuery when it has `multiple` attribute -


i have following input type file multiple attribute:

<input accept=".txt" id="file" multiple="" name="file" type="file" /> 

when use jquery read input value:

$("#file").val() 

i selected pc, 2 files. if call above function returns:

c:\fakepath\1.txt 

i expect return 2 file values (i don't know, separated comma or other separator).

you can use files property like

var files = $("#file").prop('files') 

then loop , read name property of file

demo: fiddle


Comments

Popular posts from this blog

android - Inheriting from Theme.AppCompat* -

broadcastreceiver - android BOOT_COMPLETED not received if not activity intent-filter -

basic authentication with http post params android -