Re: Missing CustomProvider

  •  09-26-2011, 8:13 AM

    Re: Missing CustomProvider

    Hi HinaLaitkor,
     
    The example below shows you how to add the file into the attachment list.
     
    I have a file name "test.txt" at the root of the test site.
     
    <%@ 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 button1_Click(object sender, EventArgs e)
        {
            using (FileStream fs = System.IO.File.Open(Server.MapPath("~/test.txt"), FileMode.Open))
            {
                uploader1.Items.Add(int.Parse(fs.Length.ToString()), fs.Name, fs);
            }
        }
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <CuteWebUI:UploadAttachments ID="uploader1" runat="server">
                </CuteWebUI:UploadAttachments>
                <asp:Button ID="button1" runat="server" Text="add attachment" OnClick="button1_Click" />
            </div>
        </form>
    </body>
    </html>
     
    Regards,
     
    Ken
View Complete Thread