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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

View Word doc in BLOB field

Status
Not open for further replies.

BakeMan

Programmer
Jul 24, 2002
129
US
I am trying to write an application that allows users to upload Word docs to an Oracle BLOB field and view them back later. I have worked out the load part but am running into difficulty with the view it back part. I have read and tried the code in thread333-908477 but haven't had any luck. My code looks like this:

<%@ LANGUAGE="VBSCRIPT" %>

<%

Response.Buffer = True
Response.Clear
Response.ContentType = "application/msword"
Response.AddHeader "Content-Disposition", "filename=temp.doc"

Dim id
Dim Conn
Dim RS

set Conn = server.createObject("adodb.connection")
Conn.open "Provider=OraOLEDB.Oracle;Data Source=****;User ID=****;PASSWORD=****;Persist Security Info=True"

set RS = server.createObject("adodb.recordset")

ID = 1

set rs = conn.execute("SELECT Document FROM Documents WHERE DocumentID = " & ID)

If not rs.EOF or not rs.BOF Then

response.binaryWrite rs.fields("Document").value

End If

response.flush
response.end

%>

(bear in mind this is test code). It connects to the database and extracts the BLOB information but it comes out like:

ÐÏࡱá>þÿ WYþÿÿÿTUVÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿì¥Áq ¿F bjbjt+t+ AA£ÿÿÿÿÿÿ]ÖÖÖÖÖÖÖêêêêêþê¶&¦ÌÌÌÌÌ–b\¾0°²²²²²²$¹ô­VÖ-ÖîÌÌîîÖòÖÖÌÌ&òòòî‚ÖÌÖÌ°êêÖÖÖÖî°ò¾ò°ÖÖ°Ì Àzæ5SPÂêêp‚° REQUEST FOR WAIVER OF COMPETITIVE BIDS REQUEST DATE  FORMTEXT       WORK/MATERIAL DESCRIPTION  FORMTEXT       WE REQUEST THAT COMPETITIVE BIDS FOR THIS WORK BE WAIVED BASED UPON THE FOLLOWING: 1. FORMCHECKBOX 

... (More of the same) ...

ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRoot Entryÿÿÿÿÿÿÿÿ ÀF€Î¾5SPÂ`Õ6SPÂZ€Data ÿÿÿÿÿÿÿÿÿÿÿÿ E^1Tableÿÿÿÿÿÿÿÿ<WordDocumentÿÿÿÿSummaryInformation(ÿÿÿÿÿÿÿÿÿÿÿÿDDocumentSummaryInformation8ÿÿÿÿÿÿÿÿL`Õ6 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿþÿ ÿÿÿÿ ÀFMicrosoft Word Document MSWordDocWord.Document.8ô9²q


Does anyone have any idea how I can actually view the file as a Word Doc?

Thank you in advance for your help.

BAKEMAN [pimp]
 
try this:

Code:
Response.ContentType = "application/vnd.ms-word"

instead of the one you had in the code...

-DNG
 
I guess that solved it... sort of. I changed the code like you suggested and it still didn't work. so I navigated the window (the same one I had been running the code in all day) to this page to respond that it didn't work. I then thought I would change it back and try one more time before asking again. So, I closed all of the IE windows and tried it again. It worked. I've been playing with it sense and both methods seem to function. It must have been a cache thing on my PC. I feel really dumb [hammer]

Thank you DotNetGnat. Your solution ultimately lead to a working application.

Thanks again,
BAKEMAN [pimp]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top