-1

我使用 Asp.net 中的文件上传控件上传了一个 zip 文件,提交按钮后,我需要将该文件发送到 ashx 处理程序。在处理程序中,我需要按原样接收文件并将该文件保存到某个位置。如何做到这一点

4

1 回答 1

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

于 2013-06-12T06:07:42.477 回答