Re: Using DotNetZip to compress file during upload

  •  12-12-2008, 11:43 PM

    Re: Using DotNetZip to compress file during upload

    Hi jmestep,
     
    Please try this 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 void uploader1_FileUploaded(object sender, UploaderEventArgs args)
        {
            Ionic.Utils.Zip.ZipFile file = new Ionic.Utils.Zip.ZipFile(Response.OutputStream);
            file.AddFileStream(args.FileName, "", args.OpenStream());
            file.Save("C://test//" + args.FileName + ".zip");
        }
    </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:Uploader ID="uploader1" runat="server" OnFileUploaded="uploader1_FileUploaded">
                </CuteWebUI:Uploader>
            </div>
        </form>
    </body>
    </html>

     
     
    Regards,
     
    Ken
View Complete Thread