C# ZipArchive.CreateEntryFromFile() does not add file from disk to archive
I have following code in .NET 4.5 to send email attachment using SmtpClient. I am adding memory stream created below to Attachement collection of message. using System.IO; using System.IO.Compression; var memoryStream = new MemoryStream(); using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true)) { archive.CreateEntryFromFile(@"c:\Files\File1.txt", "File1.txt"); } When I receive a email, it shows zip file but the archive does not have File1.txt. What's missing here?
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.