Skip to main content
October 6, 2006
Question

file corrupted after downloaded from SQL table

  • October 6, 2006
  • 1 reply
  • 333 views
I'm trying to download a file which is saved in the SQL table as base64 string and save it on the webserver. It works with the file size less than 45K. Beyond that, file got corrupted. Can somebody help me solve this issue? Thanks.
PS: We are using MX 6.1
Code:
<cfquery name="file" DATASOURCE="#application.adjsource#" USERNAME="#application.adjuser#" PASSWORD="#application.adjword#">
SELECT a.keyno,a.filename,a.notes,a.bindata
FROM datastore a
WHERE a.keyno = 123
</cfquery>
<cfset filepath = getdirectoryfrompath(getcurrenttemplatepath()) & 'temp\#file.filename#'>
<cfset tmpfile= tobinary(file.bindata)>
<cffile action="write" nameconflict="overwrite" addnewline="yes" output="#tmpfile#" file="#filepath#">
This topic has been closed for replies.

1 reply

Inspiring
October 6, 2006
Check the long text value in CF Administrator. You may need to adjust that value to handle longer field returns.
October 6, 2006

Thanks.