Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
4
Reply
How create zip file by selecting listview items ?
Mani Kandan
Jan 3 2017 11:23 AM
263
Reply
Hello everyone,
How can I create listview selected each images create as a Zip file?
Now error occured.
'
Access to the path 'c:\example' is denied.
'
string
FileName = @
"c:\example"
;
if
(Directory.Exists(FileName))
{
foreach
(Tble_Documents item
in
listView1.SelectedItems)
{
string
[] files = Directory.GetFiles(System.IO.Path.GetDirectoryName(item.Fullname),
"*.jpg"
);
using
(FileStream zipToOpen =
new
FileStream(FileName, FileMode.Open))
/*
Here occurring that error
*/
{
using
(ZipArchive archive =
new
ZipArchive(zipToOpen, ZipArchiveMode.Create))
{
foreach
(var file
in
files)
{
archive.CreateEntryFromFile(file, file);
}
}
}
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
Datagrid checkbox not workign in single click
i just wanted to bind data trigger with chkbox