i want to download selected file in a zip and it work but problem is it include all folder and i want add only one folder which is the name of that movie.
i have used the code
protected void btnDownload_Click(object sender, EventArgs e)
{
using (ZipFile zip = new ZipFile())
{
foreach (GridViewRow gvrow in GridView1.Rows)
{
CheckBox chk = (CheckBox)gvrow.FindControl("chkSelect");
if (chk.Checked)
{
string filePath = Server.MapPath(gvrow.Cells[2].Text);
zip.AddFile(filePath);
}
}
Response.Clear();
Random r = new Random();
Response.AddHeader("content-disposition", "filename=" + "download" + r.Next(100, 1000).ToString() + ".zip");
// Response.AddHeader("Content-Disposition", "attachment; filename=DownloadedFile.zip");
Response.ContentType = "application/zip";
zip.Save(Response.OutputStream);
Response.End();
}
and in the zip has all folder whatever has in my project.
i want only files inside zip and don't want any folder please reply me.