troubleshooting Question

AJAX Upload

Avatar of RecipeDan
RecipeDan asked on
9 Comments1 Solution803 ViewsLast Modified:

I am using .Net 4.5. When I use the AJAX FileUpload,the files upload to the directory ok but the Label1.Text and Label2.Text do not fire. I do not get an error message even though I use try catch.

    <form id="form1" runat="server">
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" />
        <asp:AjaxFileUpload ID="AjaxFileUpload1" AllowedFileTypes="mp4" OnUploadComplete="AjaxFileUpload1_UploadComplete" runat="server" />
        <br />
        <br />
        <asp:Label ID="Label1" runat="server" />
        <br />
        <br />
        <asp:Label ID="Label2" runat="server" />
        protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
                AjaxFileUpload1.SaveAs(MapPath("~/App_Data/" + e.FileName));
                if (e.State == AjaxControlToolkit.AjaxFileUploadState.Success)
                    Label1.Text = e.FileName;
                    Label2.Text = e.FileSize.ToString();
            catch (Exception ex)
Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros