Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying Blobs with plugins 1

Status
Not open for further replies.

ababbitt

Programmer
Sep 7, 2001
7
US
I have written a page that will display/download files stored as blobs in a database. Everything seems to be working just fine, except for one thing. If the MIME-type requires a plug-in to display properly, it does not use the plug-in. It just prompts the user to download/open the file. If you download or open the file it will launch the viewer for the file type.

For example, instead of seeing a PDF file in IE or Netscape using the brower plugins, it will launch Adobe Acrobat Reader.

My question is this: How do I display a binary stream(blob) and have it use plugins when required?

My code is as follows:

<%
Response.Buffer = TRUE
Response.Clear
Response.ContentType = oDocument.MIME
Response.AddHeader &quot;Content-Disposition&quot;,&quot;attachment;filename=Mypdf.pdf&quot;

if oDocument.MIME = &quot;text/html&quot; or oDocument.MIME = &quot;text/plain&quot; then
Response.Write oDocument.DataStream
else
Response.BinaryWrite(oDocument.DataStream)
end if

Response.Flush
%>

Where oDocument is an object that contains the data.

Any help would be greatly appreciated.

 
I think this will work :

<%
Response.Buffer = TRUE

if oDocument.MIME = &quot;text/html&quot; or oDocument.MIME = &quot;text/plain&quot; then
Response.Write oDocument.DataStream
else
Response.ContentType = oDocument.MIME
Response.BinaryWrite(oDocument.DataStream)
end if

Response.Flush
%> Regards

Big Dave


** If I am wrong I am sorry, but i'm only trying to help!! **

 
It did help. I now realize that if I want to force a file to download I need to add the line:

Response.AddHeader &quot;Content-Disposition&quot;,&quot;attachment;filename=Mypdf.pdf&quot;

and if I want to use the plug-in I should omit it.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top