TTC*_*TCG 14 c# zip sharpziplib
我需要将3个文件合并为1个zip文件,并为用户下载.除了一件事,我能够实现我的要求:它将文件压缩到子文件夹中.
例如,我的文件位置如下:
C:\TTCG\WebSites\Health\ABC.CSV
C:\TTCG\WebSites\Health\XYZ.CSV
C:\TTCG\WebSites\Health\123.CSV
Run Code Online (Sandbox Code Playgroud)
但是在zip文件中,它使用"TTCG\WebSites\Health \"作为路径压缩文件夹中的文件.请参阅附件.

我不想要路径中的文件夹.我只想在没有文件夹的zip文件中有3个文件.我怎样才能做到这一点?
我生成zip文件的代码如下:
ZipFile z = ZipFile.Create(Server.MapPath("~" + @"\Accident.zip"));
//initialize the file so that it can accept updates
z.BeginUpdate();
//add the file to the zip file
z.Add(Server.MapPath("~" + @"\ABC.csv"));
z.Add(Server.MapPath("~" + @"\XYZ.csv"));
z.Add(Server.MapPath("~" + @"\123.csv"));
//commit the update once we are done
z.CommitUpdate();
//close the file
z.Close();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29694 次 |
| 最近记录: |