using Ionic.Zip;
protected void btnDownload_Click(object sender, EventArgs e)
{
using (ZipFile zip = new ZipFile())
{
foreach (GridViewRow gvrow in gvDetails.Rows)
{
CheckBox chk = (CheckBox)gvrow.FindControl("chkSelect");
if (chk.Checked)
{
string fileName = gvrow.Cells[1].Text;
string filePath = Server.MapPath("~/UploadedResumeByUsers/" + fileName);
zip.AddFile(filePath, "files");
}
}
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=DownloadedFile.zip");
Response.ContentType = "application/zip";
zip.Save(Response.OutputStream);
Response.End();
}
}
No comments:
Post a Comment