且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过javascript获取文件上传文件的文件名

更新时间:2022-10-15 11:59:28

Try the value property, like this:

var fu1 = document.getElementById("FileUpload1");
alert("You selected " + fu1.value);

NOTE: It looks like FileUpload1 is an ASP.Net server-side FileUpload control.
If so, you should get its ID using the ClientID property, like this:

var fu1 = document.getElementById("<%= FileUpload1.ClientID %>");