Opening Binary Files

Results 1 to 2 of 2

Thread: Opening Binary Files

  1. #1
    John Harvey Guest

    Default Opening Binary Files

    Hi,<BR>I was wondering if anyone knew how to open files in binary format (like as a binary stream) to be written directly to the client. I want to write a gif directly to the browser without using an &#060;image> tag. I can get the headers, but I can&#039t open a file as anything but a text stream. Please don&#039t make me use PERL...<BR>John

  2. #2
    Chris S. Guest

    Default RE: Opening Binary Files

    This is how I call an image from a SQL database, hope it helps.<BR><BR>This is the img tag snippet on the page which calls another APS page, listed below:<BR><BR>&#060;img src="image.asp" alt="Image"><BR><BR>-------<BR><BR>This is the seperate image.asp file:<BR><BR>&#060;%@ LANGUAGE="VBSCRIPT" &#037;&#062;<BR><BR>&#060;%<BR>&#039 Clear out the existing HTTP header information<BR>Response.Expires = 0<BR>Response.Buffer = TRUE<BR>Response.Clear<BR><BR>&#039 Change the HTTP header to reflect that an image is being passed.<BR>Response.ContentType = "image/gif"<BR><BR>Set objConnection = Server.CreateObject("ADODB.Connection")<BR><BR>obj Connection.Open Session("DataConn_Connection")<BR>Set objRecordset = objConnection.Execute("SELECT image FROM &#060;TABLE> WHERE &#060;FIELD>=" & Session("VARIABLE") & "")<BR>Response.BinaryWrite objRecordset("FIELD")<BR>Response.End<BR>&#037;&#0 62;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •