Re: Get the number of files selected for upload

  •  11-04-2008, 7:24 AM

    Re: Get the number of files selected for upload

    Hi Epok,
     
     
    Try this example:
     

    <%@ 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">
        int addedcount = 0;
        void InsertMsg(string msg)
        {
            ListBoxEvents.Items.Insert(0, msg);
            ListBoxEvents.SelectedIndex = 0;
        }
     
     protected void Attachments1_AttachmentAdded1(object sender, AttachmentItemEventArgs args)
        {
            addedcount++;
            InsertMsg(args.Item.FileName + " has been uploaded.");
         
        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (addedcount > 0)
            {
                InsertMsg(addedcount + " files have been uploaded");
                //when all files upload complete will fire
                Response.Write("<script>BLOCKED SCRIPTalert('done')<" + '/' + "script>");
            }
        }

      
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <CuteWebUI:UploadAttachments InsertText="Upload Multiple files Now" runat="server"
                    ID="Attachments1" OnAttachmentAdded="Attachments1_AttachmentAdded1">
                </CuteWebUI:UploadAttachments>
                <br />
                <asp:ListBox runat="server" ID="ListBoxEvents" Width="400"></asp:ListBox>
            </div>
        </form>
    </body>
    </html>

     
     
    Regards,
     
    Ken
View Complete Thread