I need to construct and send a zip to a user.
I've seen examples doing one or the other, but not both, and am curious if there are any 'best practices' or anything.
Sorry for the confusion. I'm going to generating the zip on the fly for the web user, and sending it to them in the HTTP response. Not in an email.
Mark
I would second the vote for SharpZipLib to create the Zip file. Then you'll want to append a response header to the output to force the download dialog.
http://aspalliance.com/259
should give you a good starting point to achieve that. You basically need to add a response header, set the content type and write the file to the output stream:
Response.AppendHeader( "content-disposition", "attachment; filename=" + name );
Response.ContentType = "application/zip";
Response.WriteFile(pathToFile);
That last line could be changed to a Response.Write(filecontents) if you don't want to save to a temp file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With