Hello,
I used RadAsyncUpload control to accept a upload zip file. My zip file contains text delimiter files. I am able to unzip it to a temporary directory, but if I try again with the same zip file I get error something like "...because it is being used by another process." (at line 17)
Below is my method to unzip:
Please help,
Thanks,
Sam
I used RadAsyncUpload control to accept a upload zip file. My zip file contains text delimiter files. I am able to unzip it to a temporary directory, but if I try again with the same zip file I get error something like "...because it is being used by another process." (at line 17)
Below is my method to unzip:
01.
private
static
void
UnpackAndSaveFile(ZipPackageEntry entry,
string
destinationPath)
02.
{
03.
Stream stream = entry.OpenInputStream();
04.
var fileName = destinationPath +
"\\"
+ entry.FileNameInZip;
05.
06.
var directoryName = Path.GetDirectoryName(fileName);
07.
08.
if
(directoryName !=
null
)
09.
{
10.
if
(!Directory.Exists(directoryName))
11.
{
12.
Directory.CreateDirectory(directoryName);
13.
}
14.
15.
if
(System.IO.File.Exists(fileName))
16.
{
17.
System.IO.File.Delete(fileName);
18.
}
19.
20.
StreamReader reader =
new
StreamReader(stream);
21.
string
text = reader.ReadToEnd();
22.
File.WriteAllText(fileName, text);
23.
}
24.
}
Please help,
Thanks,
Sam