2

モイン!

 using (ZipFile zip = new ZipFile())
 {
     // add this map file into the "images" directory in the zip archive
     zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images");
     // add the report into a different directory in the archive
     zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files");
     zip.AddFile("ReadMe.txt");
     zip.Save("MyZipFile.zip");
 }

この例では、MyZipFile.zip を "C:\Program Files (x86)\IIS Express" に保存します。ネット上で簡単な例が見つかりません。そのパスを変更する方法はありますか? 私のウェブホストでそこに行く権限があるとは思えません。

4

1 に答える 1

11

save メソッドまたは宣言時にパスを変更します。

ZipFile zip = new ZipFile("C:\\MyFile.Zip");

また

using (ZipFile zip = new ZipFile())
 {
     // add this map file into the "images" directory in the zip archive
     zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images");
     // add the report into a different directory in the archive
     zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files");
     zip.AddFile("ReadMe.txt");
     zip.Save("C:\\MyZipFile.zip");
 }

さらにヘルプが必要な場合

于 2012-06-18T14:24:05.287 に答える