1

哪里出错了?如果我不使用 ajax,那么表单是有效的,并且文件正在上传,但是现在页面重新加载并且...文件没有加载到路径中,为什么?

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <p>

       <asp:FileUpload ID="FileUpload1" runat="server" />
        &nbsp;<asp:Button ID="Button1" runat="server" onclick="Upload" Text="downdoad..." 
        BackColor="#0099CC" Font-Size="Small" />
    </p>
    </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
        <ProgressTemplate>
            downdoad...
        </ProgressTemplate>
    </asp:UpdateProgress>
4

2 回答 2

3

Fileupload 在更新面板中不起作用,您可以在此 url http://www.codeproject.com/useritems/simpleajaxupload.asp上找到解决方法

于 2012-08-04T16:40:26.887 回答
-1
protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(Server.MapPath("~/Uploads" + FileUpload1.FileName));
            Label1.Text = "Saved Successfully";
        }
        else 
        {
            Label1.Text = "File Not found";
        }
    }

在上面的代码文件中没有添加上传文件夹

于 2015-02-07T04:38:56.903 回答