Code .NET SQL
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
Le Deal du moment :
ETB Pokémon Fable Nébuleuse : où ...
Voir le deal

Ouvrir fichier - telechargement

Aller en bas

Ouvrir fichier - telechargement Empty Ouvrir fichier - telechargement

Message  Admin Mer 21 Nov - 15:46

Code:
protected void LinkButtonDocOnClick(object sender, EventArgs e)
    {
        string path = string.Empty;
        string filename = ((LinkButton)sender).Text;
        if (!string.IsNullOrEmpty(((LinkButton)sender).CommandArgument))
            path = ApplicationManager.UploadFile + "\\" + ((LinkButton)sender).CommandArgument;

        if (System.IO.File.Exists(path))
        {
            System.IO.FileInfo file = new System.IO.FileInfo(path);
            Response.Clear(); // clear the current output content from the buffer
            Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename);
            Response.AppendHeader("Content-Length", file.Length.ToString());
            Response.ContentType = "application/octet-stream";
            Response.WriteFile(file.FullName);
            Response.End();
        }


    }


Ou


Code:
string path = HttpContext.Current.Server.MapPath("~") +"\\"+ ApplicationManager.UploadDocumentFile + "\\" + filename;

Admin
Admin

Messages : 91
Date d'inscription : 20/09/2007

https://moaner101.forumpro.fr

Revenir en haut Aller en bas

Revenir en haut


 
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
Ne ratez plus aucun deal !
Abonnez-vous pour recevoir par notification une sélection des meilleurs deals chaque jour.
IgnorerAutoriser