Support forums
in

How can I throw a server side error if file upload is not successful

Last post 08-05-2011, 7:47 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  08-02-2011, 9:23 PM 69203

    How can I throw a server side error if file upload is not successful

    How can I throw a server side error if file upload is not successful?
     
    Thanks.
     
    Ron 
  •  08-05-2011, 7:47 AM 69298 in reply to 69203

    Re: How can I throw a server side error if file upload is not successful

    hi RonR,
     
    Please try the example below. Upload a large file to fire the error.
     
    <%@ Page Language="C#" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">

        protected void b1_Click(object sender, EventArgs e)
        { //add you server side method here
            lbErrorMessage.Text = "server side error message";
        }
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>example</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <CuteWebUI:UploadAttachments ID="attachemnt1" runat="server">
                <ValidateOption MaxSizeKB="100" />
            </CuteWebUI:UploadAttachments>
            <asp:Label ID="lbErrorMessage" runat="server"></asp:Label>
            <asp:Button ID="b1" runat="server" Style="visibility: hidden" OnClick="b1_Click" />
        </form>
    </body>
    </html>

    <script>
       function CuteWebUI_AjaxUploader_OnError(msg)
    {
        var b1=document.getElementById("<%= b1.ClientID %>");
        b1.click();
        return false;
    }

    </script>
     
    Regards,
     
    Ken
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems