Reading Word Doc in MS SQL Image field to app

Get extra characters and breaks in MS Word doc read from SQL Server Im

Page 1 of 1

0 Replies - 2668 Views - Last Post: 08 December 2009 - 02:18 PM Rate Topic: -----

#1 DuneRatt   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-December 09

Reading Word Doc in MS SQL Image field to app

Post icon  Posted 08 December 2009 - 02:18 PM

I'm uploading documents to an MS SQL Image field then trying to display them through a cfm page. I get the document but lots of return chars and page breaks inserted. What am I missing? Here is the code:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<!--- Param URL data. --->
<cfparam name="URL.docid" type="numeric" default="17" />

<!--- Query for record and pull back image binary. --->
<cfquery name="qDoc" datasource="#Application.DSN#">
SELECT
h.documentid,
h.filename,
h.docFileImage
FROM
documents h
WHERE
h.documentid =
<cfqueryparam
value="#URL.docid#"
/>
</cfquery>
<cfheader name="Content-Disposition" value="attachment; filename=#qDoc.filename#">
<cfcontent type="application/msword">

<cfscript>
writeOutput(ToString(qDoc.docFileImage));
</cfscript>


</body>
</html>

Is This A Good Question/Topic? 0
  • +

Page 1 of 1