Problem with downloading a file from a database

  • Thread starter Thread starter LoneWolf
  • Start date Start date
L

LoneWolf

I am trying to allow a user to download a file that has been stored within
a database. So far I am able to retrieve the binary information from the db
and show it in the web browser (in the instance of text or an image file).
However, what I am wanting, is to allow the user to download it directly to
their computer without having it displayed in the browser.

Below is the code I have:

Public Sub LinkButton1_Click(ByVal _oSender As Object, ByVal _e As
System.EventArgs)
Dim iKey As Integer = Integer.Parse(CType(_oSender,
LinkButton).CommandArgument)
Dim fFile As DocMGR.File = CType(alFiles(iKey - 1), DocMGR.File)
Response.BinaryWrite(CType(fFile.getFile, Byte()))
End Sub

the BinaryWrite writes the content directly to the page... which is not what
I am wanting.

Any suggestions on how to get the data to transfer directly to the user's
hard drive?
 
I suggest first storing the file from the database to a file on the
server, then have the stored file downloaded to the user.

T
 
Back
Top