Using DotNetZip to compress file during upload

  •  12-10-2008, 11:55 AM

    Using DotNetZip to compress file during upload

    I am using the uploader fine as it is, but would like to be able to compress the files as they are uploaded. I've seen the forum post with sample code, but haven't figured out how to integrate it with my code.
    I've added to my C# class:
    using Ionic.Utils.Zip;
    My current code block is:

    Uploader uploader = (Uploader)sender;

    uploader.SetAdvancedOption(UploaderAdvancedOption.NoFlash10, "true");

    InsertMsg("File uploaded! " + args.FileName + ", " + args.FileSize + " bytes.");

    string selectedItem = DropDownListTemplateFields.SelectedItem.Text.ToString();

    selectedItem = StringHelper.Replace(selectedItem," ","");

    string folder = Server.MapPath("~/Assets/OrderUploads");

    string thisOrderId = OrderId.ToString();

    string pathURL = "../Assets/OrderUploads/";

    string fileName = thisOrderId + "-" + DateTime.Now.ToString("yyyyMMddHmm") + "-" + selectedItem + "-" + args.FileName;

     

    string mypath = Path.Combine(folder, fileName);

    args.CopyTo(mypath);
     
     
    How can I integrate it? It is for only one file at a time.
    Thanks,
View Complete Thread