开发者

problem: zip files in mvc

开发者 https://www.devze.com 2023-02-06 03:55 出处:网络
i am using SharpZipLib. i copied code from link text i use it to zip files in my App_Data folder. All goes right but when i want to delete files i can not do it. it says

i am using SharpZipLib. i copied code from

link text

i use it to zip files in my App_Data folder. All goes right but when i want to delete files i can not do it. it says teh action can't be completed because the file is open i开发者_JAVA技巧n another program. i can not solve this problem. please help


Just a shot in the dark: The sample code opens a file to Zip with

ostream = File.OpenRead(Fil);

but it never gets closed.

ostream.Close()

or better

using(ostream = File.OpenRead(Fil)) 
{
}
0

精彩评论

暂无评论...
验证码 换一张
取 消