I would like some guidance on the following problem, I have filenames stored in my database, and the actually doc is saved to HDD. I am the stage where I would like select a file to download it.
WinForm - Spawn a process that simulates the user double clicking on the file
Dim fileName As String = "MY_FILE"
Dim process = New System.Diagnostics.Process()
process.StartInfo = New System.Diagnostics.ProcessStartInfo() With { _
.UseShellExecute = True, _
.FileName = fileName _
}
process.Start()
jabaarali786
Member
61 Points
46 Posts
Downloading files
Mar 27, 2012 07:04 PM|LINK
I would like some guidance on the following problem, I have filenames stored in my database, and the actually doc is saved to HDD. I am the stage where I would like select a file to download it.
Does this make sense, appreciate any help thanks
download Database fileupload
ajb587
Member
442 Points
102 Posts
Re: Downloading files
Mar 27, 2012 07:33 PM|LINK
Winform or Webform?
ajb587
Member
442 Points
102 Posts
Re: Downloading files
Mar 27, 2012 07:37 PM|LINK
WinForm - Spawn a process that simulates the user double clicking on the file
Dim fileName As String = "MY_FILE" Dim process = New System.Diagnostics.Process() process.StartInfo = New System.Diagnostics.ProcessStartInfo() With { _ .UseShellExecute = True, _ .FileName = fileName _ } process.Start()or a short hand version
System.Diagnostics.Process.Start("My-file-name.ext");Note the user must have the appropriate program to open the file (e.g. Adobe Reader for PDF, MS Word for .doc/docx, etc)
ajb587
Member
442 Points
102 Posts
Re: Downloading files
Mar 27, 2012 07:41 PM|LINK
Web
string responseFile = Server.MapPath("~/" + FileName); Response.ContentType = "text/xml"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + FileName); Response.TransmitFile(responseFile); Response.Flush();jabaarali786
Member
61 Points
46 Posts
Re: Downloading files
Mar 27, 2012 09:24 PM|LINK
Webform