Skip to content
Loading
  
  •   
  • c#
    1. protected void btnUpload_Click(object sender, EventArgs e)  
    2. {  
    3. if (fileUpload1.HasFile)  
    4. {  
    5. string filename = Path.GetFileName(fileUpload1.PostedFile.FileName);  
    6. string path = Server.MapPath("~/Zip/SampleFiles/" + filename);  
    7. string path1 = Server.MapPath("~/Zip/ExtractFiles/" + filename);  
    8. fileUpload1.SaveAs(path);  
    9. ExtractZipFile(path, path1);  
    10. if ((System.IO.File.Exists(path)))  
    11. {  
    12. System.IO.File.Delete(path);  
    13. }  
    14. lbltxt.Text = "File Uploaded Successfully";  
    15. }  
    16. }  
    17. private void ExtractZipFile(string zipFileLocation, string destination)  
    18. {  
    19. using (Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile(zipFileLocation))  
    20. {  
    21. zip.ExtractAll(destination); //zip.Save(destination);  
    22. }  
    23. }  
    the above code is working exactly as well as live server
    0