Hi Christopher
Wouldn't it make more sense to save the pdfs or jpgs as individual files and
then
only put the link in the database.
Rob
Robert J. Voyle, Psy.D.
Director, Clergy Leadership Institute
For Coaching and Training in Appreciative Inquiry
Author: Restoring Hope: Appreciative Strategies
to Resolve Grief and Resentment
http://www.appreciativeway.com/
503-647-2378 or 503-647-2382
On 9 Aug 2013 at 10:34, Christopher Nash wrote:
>
> I'm trying to store PDF's (540k) as binary in varbinary(max) field
> MS SQL 2008 R2. But for somereason they're getting truncated. I get
> the error message "There was an error opening this document. The
> file is damaged and could not be repaired." (leads me to believe
> this is a result of truncation)
>
> I've also tested .jpg's (549k) in varbinary(max) or image fields and
> they're truncating too. About 1/3 of the image is stored for
> varbinary(max) and 2/3 for image.
>
> I've referenced many other people's similar soultions, but something
> is tripping me up?
>
> <cffile action="readBinary" file="\\TAFT\Home\COI\Insurance
> requirment Form.pdf" variable="pdffile">
> or
> <cffile action="readBinary" file="\\TAFT\Home\COI\Lighthouse.jpg"
> variable="pdffile">
>
> <cfquery name="savePDF" datasource="#session.dsnsovranmisc_gar#"
> dbtype="ODBC">
> UPDATE tblCOI
> Set binCOI = <cfqueryparam cfsqltype="CF_SQL_BLOB"
> value="#pdffile#">
> WHERE
> intID = 1
> </cfquery>
>
> <cfquery name="Contractors" datasource="#session.dsnsovranmisc_gar#"
> dbtype="ODBC">
> SELECT binCOI
> FROM tblCOI
> WHERE
> intID = 1
> </cfquery>
>
> <cfcontent type="application/pdf" variable="#Contractors.binCOI#"
> />
>
> And when I was working with an image field I returned it using the
> following code and could witness the 1/3 (varbinary(max)) and 2/3
> (image) of the photo then...
>
> <cfset myImg1 = ImageNew(Contractors.imgCOI)>
> <cfimage action="WRITETOBROWSER" source="#myImg1#">
>
>
> Where am I going wrong? My pdf's are all under 1mb so the size
> shouldn't be a problem. Had a cowrker check coldfusion administrator
> to make sure there wasn't any bad defaults for cffile.
>
> Any help/ideas are much appreciated.
>
> Thanks,
> -Chris
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~|
> Order the Adobe Coldfusion Anthology now!
> http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=
> houseoffusion
> Archive:
> http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:
> 6084
> Subscription:
> http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
> Unsubscribe:
> http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:6086
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm