Hi Made this finally work Sir,
protected void btnUpload_Click(object sender, EventArgs e)
{
List<ListItem> files = new List<ListItem>();
for (int i = 0; i < Request.Files.Count; i++)
{
HttpPostedFile PostedFile = Request.Files[i];
if (PostedFile.ContentLength > 0)
{
string FileName = System.IO.Path.GetFileName(PostedFile.FileName);
PostedFile.SaveAs(Server.MapPath("Files\\") + FileName);
string[] filePaths = Directory.GetFiles(Server.MapPath("Files\\"));
/* foreach (string filePath in filePaths)
{
files.Add(new ListItem(Path.GetFileName(FileName), filePath));
}*/
string filePath = Server.MapPath("Files\\")+FileName;
//files.Add(Path.GetFileName(FileName), filePath);
files.Add(new ListItem(Path.GetFileName(FileName),filePath));
}
}
GridView1.DataSource = files;
GridView1.DataBind();
}
protected void DownloadFile(object sender, EventArgs e)
{
string filePath = (sender as LinkButton).CommandArgument;
Response.ContentType = ContentType;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filePath) );
Response.WriteFile(filePath);
Response.End();
}
Thank you.....