-1

I uploaded one zip file using file upload control in Asp.net and after submitting the button I need to send that file to an ashx handler.In handler I need to receive the file as it is and save that file to a location.How to achieve that

Nimmi
  • 680
  • 8
  • 18

1 Answers1

0

To save the file, you will have to use the Request.Files collection.

foreach (string file in Request.Files)
{
    HttpPostedFile zipFile = Request.Files[file] as HttpPostedFile;
    if (zipFile.ContentLength > 0)
       zipFile.SaveAs("YOUR_PATH/" + file);
}

If you need to extract the contents of the zip file, you can use a library like dotNetZip

nunespascal
  • 17,584
  • 2
  • 43
  • 46