Hi all,
I am having problems with some code using cfcontent and cfheader tags. I am uploading binary contents of a database stored object to a temp directory and using the headers to display the object. This code works fine for word docs, excel docs, etc. but does not often work with jpgs. Sometime the image is displayed, other times the client application is launched but it stops and does not continue to display the image. I have included my code below. Can anyone help? We have recently moved the app to a CF5.0 server and I am wondering if this might be part of the issue. This happens on every client machine I have tested it on (around 5 machines). Thanks!
Jami
<cffile action="write" file="#dest#" output="#ToBinary(newBuffer)#">
<cfheader name="Content-Disposition" value="inline; filename=#myDoc.FILE_NAME#">
<cfif UCase(ListLast(myDoc.FILE_NAME, ".") IS "PDF">
<cfcontent type="application/pdf" file="#dest#" deletefile="yes">
<cfelseif UCase(ListLast(myDoc.FILE_NAME, ".") IS "JPG">
<cfcontent type="application/jpeg" file="#dest#" deletefile="yes">
<cfelse>
<cfcontent type="application/unknown" file="#dest#" deletefile="yes">
</cfif>
I am having problems with some code using cfcontent and cfheader tags. I am uploading binary contents of a database stored object to a temp directory and using the headers to display the object. This code works fine for word docs, excel docs, etc. but does not often work with jpgs. Sometime the image is displayed, other times the client application is launched but it stops and does not continue to display the image. I have included my code below. Can anyone help? We have recently moved the app to a CF5.0 server and I am wondering if this might be part of the issue. This happens on every client machine I have tested it on (around 5 machines). Thanks!
Jami
<cffile action="write" file="#dest#" output="#ToBinary(newBuffer)#">
<cfheader name="Content-Disposition" value="inline; filename=#myDoc.FILE_NAME#">
<cfif UCase(ListLast(myDoc.FILE_NAME, ".") IS "PDF">
<cfcontent type="application/pdf" file="#dest#" deletefile="yes">
<cfelseif UCase(ListLast(myDoc.FILE_NAME, ".") IS "JPG">
<cfcontent type="application/jpeg" file="#dest#" deletefile="yes">
<cfelse>
<cfcontent type="application/unknown" file="#dest#" deletefile="yes">
</cfif>