为什么上传文件的文件路径未定义?

时间:2016-01-13 20:03:30

标签: javascript asp.net ajax asyncfileupload

我在asp.net里面的更新面板中有ajax异步文件上传控件。我已经调用了javascript函数来获取上传文件的文件名,但它总是提供 未定义文本 。为什么?

<asp:AsyncFileUpload ID="FileUpload1" OnClientUploadComplete="uploadComplete" ClientIDMode="AutoID" UploaderStyle="Modern" runat="server"/>
asp:HiddenField ID="HdnFieldEmployeePicture" runat="server" />
<asp:HiddenField ClientIDMode="Static" ID="HdnFieldHasFileUploaded" runat="server" />
<asp:HiddenField ClientIDMode="Static" ID="UploadedFilePath" runat="server" />

调用此函数:

<script type="text/javascript">
        function uploadComplete(sender, args) {
            var myHidden = document.getElementById('<%= HdnFieldHasFileUploaded.ClientID %>');
            myHidden.value = '1';

            var fu1 = args.get_fileName();
            UploadedFilePath.value = fu1.value;

        }
    </script>

fu1 总是未定义,为什么?

0 个答案:

没有答案