Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. downloading a file

downloading a file

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabase
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    murari_amar
    wrote on last edited by
    #1

    I am working on a small project in asp.net,I saved a file in a folder in the project and i saved the path of the file in the database,now i want to download the file saved in the folder through the path saved in database can please somebody send me the code for this thanking you Amar

    S 1 Reply Last reply
    0
    • M murari_amar

      I am working on a small project in asp.net,I saved a file in a folder in the project and i saved the path of the file in the database,now i want to download the file saved in the folder through the path saved in database can please somebody send me the code for this thanking you Amar

      S Offline
      S Offline
      sasidar_d
      wrote on last edited by
      #2

      Hi Amar I have pasted the part of the code snippet which will allow you to show the windows download dialog button. This should be called on any of the server click event by passing the file name Hope this will solve your problem mypath = myFileName file = New System.IO.FileInfo(mypath) If file.Exists Then frm.Response.Clear() frm.Response.AddHeader("Content-Disposition", "attachment; filename=" & file.Name) frm.Response.AddHeader("Content-Length", file.Length.ToString()) frm.Response.ContentType = strType frm.Response.WriteFile(file.FullName) frm.Response.End() Else frm.Response.Write("This file does not exist.") End If Happy Programming Sasidar -- modified at 10:02 Wednesday 14th June, 2006

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups