Re: UploadereventArgs

  •  12-07-2011, 6:16 AM

    Re: UploadereventArgs

    Hi dbots,
     
    Please try the example below. When you click on the submit button, the upload will start and the upload files will save into the "photos" folder in the button click event.
     
    <%@ 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 SubmitButton_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < Uploader1.Items.Count; i++)
            {
                Uploader1.Items[i].CopyTo("~/photos/" + Uploader1.Items[i].FileName);
            }
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Start uploading manually</title>
        <link rel="stylesheet" href="demo.css" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
            <div style="text-align: left">
                <CuteWebUI:UploadAttachments runat="server" ManualStartUpload="true" ID="Uploader1">
                </CuteWebUI:UploadAttachments>
                <br />
                <asp:Button runat="server" ID="SubmitButton" OnClientClick="return submitbutton_click()"
                    Text="Submit" OnClick="SubmitButton_Click" />
            </div>
            <script type="text/javascript">
    function submitbutton_click()
    {
    var submitbutton=document.getElementById('<%=SubmitButton.ClientID %>');
    var uploadobj=document.getElementById('<%=Uploader1.ClientID %>');
    if(!window.filesuploaded)
    {
    if(uploadobj.getqueuecount()>0)
    {
    uploadobj.startupload();
    }
    return false;
    }
    window.filesuploaded=false;
    return true;
    }
    function CuteWebUI_AjaxUploader_OnPostback()
    {
    window.filesuploaded=true;
    var submitbutton=document.getElementById('<%=SubmitButton.ClientID %>');
    submitbutton.click();
    return false;
    }
            </script>
        </form>
    </body>
    </html>
     
    Regards,
     
    Ken 
View Complete Thread