Can't get value of input type=“file”?

后端 未结 8 2091
谎友^
谎友^ 2020-11-27 16:48

I have a

When I\'m using: alert($(\"#uploadPicture\").val());

It ale

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-27 17:04

    It's old question but just in case someone bump on this tread...

    var input = document.getElementById("your_input");
    var file = input.value.split("\\");
    var fileName = file[file.length-1];
    

    No need for regex, jQuery....

提交回复
热议问题