# How to make a file to be downloaded ..?

Need to do the show the file from db ,

i have the file in the folder  and that filename inthe table ,

how can i show that file to be downloadable .
this below CODE brings the FILENAME ...

but "couldnt" able to show the file ,

so that the user can download ....
plz suggest..?

``````Public Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As EventArgs)
con = New SqlConnection(ConfigurationSettings.AppSettings("str1"))
cmd= New SqlCommand("Single_Date", con)
cmd.CommandType = CommandType.StoredProcedure
Dim parameter_Date As New SqlParameter("@_Date", SqlDbType.DateTime, 8)
parameter_Date.Value = Calendar1.SelectedDate
myConnection.Open()
Dim temp As String = ""
'Dim Category As String
Dim diffdbdate As DateTime
If (myDataReader.Item("freeregreq") = 1 And myDataReader.Item("escrow") = 1) Then
End If
End While
Label1.Text = temp
myConnection.Close()
End Sub
``````
LVL 18
###### Who is Participating?

Commented:
meeran03, do you have the folder as a virtual path? if so, then the http address with the location is sufficient.  You just need to append the file name from the db to the virtual path and assign it to the href of the hyperlink as
temp &= "<br>name  :" & myDataReader.Item("cname") & "<br>Filedownload: <a href='http://projext/files/t/" & myDataReader.Item("files") & "'>" & myDataReader.Item("files") & "</a>"
assuming http://projext/files/t/ as your virtual path.

But, if you have the file in a shared location or in the file system, that do not have the virtual path then refer http://www.xefteri.com/articles/show.cfm?id=8
0

CTOCommented:
You should put the file name in <A HREF> tags so that it will show as a link, but you have to provide the full path to the file.
0

ConsultantAuthor Commented:
I dint see the file name  and there is a link field which shows url f:/projext/filesfilename.txt on the status bar..
temp &= "<br>name  :" & myDataReader.Item("cname") & "<br>Filedownload: <a href=""F:\projext\files" & myDataReader.Item("files") & """>"

thanks..
0

ConsultantAuthor Commented:
temp &= "<br>name  :" & myDataReader.Item("cname") & "<br>Filedownload: <a href=""http://F:/projext/files/t"">" & myDataReader.Item("files") & "</a>"

this is transfering the page to this url and loading the cannot open page rather than downloading the file
0

ConsultantAuthor Commented:
thanks .. i created the virtual path and did...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.