How To Download then Save As Any Registered File Name

Do Not Send Any Question Into This Mail Address
"Bluechip_Asia@yahoo.com"

'Created By IMAWA (Made In Bali)
'For Educational Purpose Only
'STMIK Bandung

Create then running this function (at: on click event handler) :
DownloadFromFile("uploadcache extfile.txt")


'Created by IMAWA
Public Sub DownloadFromFile(ByVal TFileTarget As String)
Dim st As System.IO.Stream
Dim b() As Byte
Dim FileSource = Request.ServerVariables("APPL_PHYSICAL_PATH") & TFileTarget
Dim FileReader As FileStream
Try
FileReader = File.Open(FileSource, FileMode.Open)
st = FileReader
ReDim b(st.Length)
st.Read(b, 0, CInt(st.Length))
Response.ClearHeaders()
Response.ClearContent()
Response.ContentType = "application/"
Response.BinaryWrite(b)
Response.End()
FileReader.Close()
Catch ex As Exception
Exit Sub
End Try
End Sub




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories