Binary System | data | Database <%
driver_name1= "Driver={microsoft Access driver (*.mdb)}; Dbq=d:\ database \tree. MDB "' Root database Open statement
Dim search,rs,j
Search= "SELECT * from Files where id=" & Request.QueryString ("ID")
Set My_conn=server. CreateObject ("Adodb.connection")
My_conn.open driver_name1
Set Rs=server.createobject ("ADODB. Recordset ")
Rs. Open search,my_conn,1,3
If Rs.bof or rs.eof then
Response.Write "Error: The file cannot be found"
Response.End
End If
' Set the size and MIME type of the file
Function setfordisplay (field, ContentType)
ContentType = LCase (Trim (contentType))
nfieldsize = field. ActualSize
bytes = field. GetChunk (Nfieldsize)
Session ("Bytes") = Bytes
Session ("Type") = ContentType
End Function
Setfordisplay rs ("File"), RS ("FileType")
' Response.AddHeader ' content-disposition ', ' attachment; Filename= "& RS (" FileName ")
Response.ContentType = Session ("Type")
Response. BinaryWrite session ("Bytes")
Session ("Type") = ""
Session ("Bytes") = ""
Set rs=nothing
My_conn.close
Set my_conn=nothing
%>