Upload a specific files from Zip File.

Last post 01-06-2010, 3:36 PM by Eric. 1 replies.
Sort Posts: Previous Next
  •  01-05-2010, 10:42 AM 58054

    Upload a specific files from Zip File.

    Hello Forum,
     
    I want to upload specific extension files e.g. ".txt" from a zip file. and i want those files to show up in my attachment. right now for uploading file i am using args.Item.CopyTo(SaveDirectory) path.
     
    Help is greatly appreciated.
     
    Thanks,
    Anand.
  •  01-06-2010, 3:36 PM 58069 in reply to 58054

    Re: Upload a specific files from Zip File.

     
    Please refer to the following code:
     
    <%@ 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 override void OnInit(EventArgs e)
        {
            Attachments1.InsertButton.Style["display"] = "none";
        }  
        void Uploader_FileUploaded(object sender, UploaderEventArgs args)
        {        
            using (System.IO.Stream stream = args.OpenStream())
            {
                Attachments1.Upload(args.FileSize, "ChangeName-" + args.FileName, stream);
            }
        }      
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Uploading multiple files</title>
        <link rel="stylesheet" href="demo.css" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
            <div class="content">
                <h2>
                    Uploading multiple files (Limit the maximum allowed number of files to be uploaded)</h2>
                <p>
                    This example shows you how to limit the maximum allowed number of files to be uploaded.
                    In the following example, you can only upload 3 files.</p>
                <br />
                <fieldset style="height: 130px">
                    <legend>
                        <CuteWebUI:Uploader runat="server" ID="Uploader1" InsertText="Upload Multiple files Now"
                            MultipleFilesUpload="true" OnFileUploaded="Uploader_FileUploaded">
                         <ValidateOption AllowedFileExtensions="txt"  />
                        </CuteWebUI:Uploader>
                    </legend>
                    <div>
                        <CuteWebUI:UploadAttachments runat="server" ID="Attachments1" >
                        </CuteWebUI:UploadAttachments>
                    </div>
                </fieldset>           
            </div>
        </form>
    </body>
    </html>
     
    Regards,
    Eric
View as RSS news feed in XML