Hi, am trying to get a file download from a SQL 2000 database Win 2K. I am not too clear on the creation of the DB (as my colleague built it) but I am attempting to access a file download.
I have got file uploads working but I am having trouble downloading the binary stream.
I keep getting the output "AdVarBinary" written back to me.
The code for my download is as follows:
FILE NAME: VIEW.ASP
****START OF VIEW.ASP****
<% Response.Buffer = True %>
<!--#include virtual="/uk/smb_calendar/includes/functions/database.asp" -->
<!--#include virtual="/uk/smb_calendar/includes/functions/exec_stored.asp" -->
<%
'EXEC STROED PROCEDURE
dim params(0)
params(0) = request("UploadID")
dim blnSucceeded
blnSucceeded = getRS("GetAnUpload",params,rs)
'PROCESS SOME VARIABLES
strfilename = rs("filename")
temp = split(filename,".")
fileExtensions = CStr(temp(1))
'STORED PROC RETURNS THE FOLLOWING
'rs("FileImage") - FILE IMAGE
'rs("filename") - the file name
'SUPPOSEDLY START THE FILE DOWNLOAD
'SHOULDNT HARD CODE CONTENT TYPE
Session("ContentType") = "text"
Session("FileImage") = rs("FileImage")
response.redirect("test.asp")
%>
****END OF VIEW.ASP****
FILE NAME: TEST.ASP
****START OF TEST.ASP****
<%
response.Expires = 0
response.Buffer = True
response.Clear
Response.AddHeader "content-disposition","attachment; filename='test.txt'"
response.contentType = Session("ContentType")
response.BinaryWrite Session("FileImage")
Session("ContentType") = ""
Session("FileImage") = ""
response.End
%>
****END OF TEST.ASP****
Can anyone help me on this? I am stuck on this one.
Any ideas please post or email
Darcey@tidal.co.uk
Thanks