mardi 24 mars 2020

How to click the link to download the file in folder?

I need to download the file in the folder that I saved all my files into it by showing the filename and click them

This is my code(I program by C# ASP.NET Webform)

protected void Page_Load(object sender, EventArgs e)
{

    DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/App_Data/"));
    FileInfo[] files = dir.GetFiles();

    foreach (FileInfo file in files)
    {
        Response.Write(@"<a href=FileExplorer.aspx?file=" + file.Name.ToString() + "'\">" + file.Name.ToString() + "</a><br />");
    }

    Response.End();
}

}




Aucun commentaire:

Enregistrer un commentaire