AEMLoviji
AEMLoviji

Reputation: 3257

problem: zip files in mvc

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 in another program. i can not solve this problem. please help

Upvotes: 2

Views: 259

Answers (1)

Arthur
Arthur

Reputation: 8129

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)) 
{
}

Upvotes: 3

Related Questions