Question
pdfs, cfcs and webservices
Hopefully someone can help me with this so I figure out what
I'm doing
wrong.
I have a cfc that is using cffile to grab pdfs, avis, mpegs, etc. and
returning it to the user. For some reason can't get it through to the user.
On the "invoking page" I'm using cfheader and cfcontent to try and send the
file as an attachment to the user, but it won't work. If I cfdump the
variable I get data, but I'm never prompted to open/save the file. Using
regular cfm pages I have no problems. I have tried read, readbinary,
toBinary with no luck.
Also I need this function to accessible as a webservice and trying that
keeps returning an error about an invalid wsdl file and couldn't create
stubs, but calling it from the same site results in the issue above but no
wsdl error.
CFC Code
-----------
<cffunction name="getFile" access="remote" displayname="Get File" hint="I
get a file based on the passed id.">
<cfargument name="docID" type="string" required="yes">
<cfset var doc = '' />
<cfset var filePath = expandPath('../Web_Support_Doc/') & arguments.docID
/>
<cffile action="readbinary" file="#filePath#" variable="doc" />
<cfreturn doc>
</cffunction>
Invocation Code
------------------
<cfsilent>
<cfset docFile =
createObject('component','_cfcs.file').getFile('1255KITG.pdf') />
</cfsilent>
<cfheader name="Content-Disposition" value="attachment;
filename=1255KITG.pdf">
<cfcontent type="application/unknown" file="#docFile#">
Web Service invocation code
---------------------------------
<cfset docFile =
createObject('webservice',' http://innet/_cfcs/file.cfc?method=getFile&docID=#url.docID#')
/>
I'm using the same cfheader/cfcontent code from above to send to user.
Any help would be greatly appreciated.
--
Bryan Ashcraft (remove brain to reply)
Web Application Developer
Wright Medical Technologies, Inc.
------------------------------------------------------------------
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) :: http://www.adobe.com/communities/experts/
wrong.
I have a cfc that is using cffile to grab pdfs, avis, mpegs, etc. and
returning it to the user. For some reason can't get it through to the user.
On the "invoking page" I'm using cfheader and cfcontent to try and send the
file as an attachment to the user, but it won't work. If I cfdump the
variable I get data, but I'm never prompted to open/save the file. Using
regular cfm pages I have no problems. I have tried read, readbinary,
toBinary with no luck.
Also I need this function to accessible as a webservice and trying that
keeps returning an error about an invalid wsdl file and couldn't create
stubs, but calling it from the same site results in the issue above but no
wsdl error.
CFC Code
-----------
<cffunction name="getFile" access="remote" displayname="Get File" hint="I
get a file based on the passed id.">
<cfargument name="docID" type="string" required="yes">
<cfset var doc = '' />
<cfset var filePath = expandPath('../Web_Support_Doc/') & arguments.docID
/>
<cffile action="readbinary" file="#filePath#" variable="doc" />
<cfreturn doc>
</cffunction>
Invocation Code
------------------
<cfsilent>
<cfset docFile =
createObject('component','_cfcs.file').getFile('1255KITG.pdf') />
</cfsilent>
<cfheader name="Content-Disposition" value="attachment;
filename=1255KITG.pdf">
<cfcontent type="application/unknown" file="#docFile#">
Web Service invocation code
---------------------------------
<cfset docFile =
createObject('webservice',' http://innet/_cfcs/file.cfc?method=getFile&docID=#url.docID#')
/>
I'm using the same cfheader/cfcontent code from above to send to user.
Any help would be greatly appreciated.
--
Bryan Ashcraft (remove brain to reply)
Web Application Developer
Wright Medical Technologies, Inc.
------------------------------------------------------------------
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) :: http://www.adobe.com/communities/experts/
