I am working on a remote call cfc that will allow remote user to upload an 
image file. Should be pretty straight forward but I am finding that the image 
being saved is not quite right and therefore NFG.

The remote call from my test cfm page is as follows...

<cfset filePath = "C:\temp\rock3.jpg" />
<cfset dataFile2 = FileRead(filePath) />
<!----- Create a Base64 representation of this string. ----->
<cfset data64 = toBase64(dataFile2)>
<!--- Convert string to binary. ---->
<cfset binaryData = toBinary(data64)>

<cfinvoke timeout="300"   method="uploadImageFile"   returnvariable="results"   
webservice="http://localdemo/billclix/billclix04.cfc?wsdl";>   <cfinvokeargument 
name="pid" value="113">  <cfinvokeargument name="buildID" 
value="PetersTestPage01">   <cfinvokeargument name="email" 
value="[email protected]">   <cfinvokeargument name="pw" value="pass123"> 
<cfinvokeargument name="imageToUpload" value="#binaryData#"></cfinvoke>

My simplified code on the cfc page is as follows...
<cfcomponent>

<cffunction name="uploadImageFile" access="remote" output="no" 
returntype="string" >
<cfargument name="imageToUpload" type="binary" required="no" default="">
<cfargument name="email" type="string" required="no" default="">
<cfargument name="pw" type="string" required="no" default="">
<cfargument name="pid" type="string" required="no" default="">
<cfargument name="buildID" type="string" required="no" default="">

<!--- Convert binary back to Base64. --->
<cfset imageToUpload2 = toBase64(arguments.imageToUpload)>
        <cffile action="write" file="c:\BillClixIn\#arguments.pid#\rock3.jpg" 
output="#ToBinary( ToBase64( arguments.imageToUpload ))#" 
nameconflict="OVERWRITE" />

<cfsavecontent variable="results">
  <result>Image Upload Done</result>
</cfsavecontent>
<cfreturn results>
</cfcomponent>

As I said the saved image is NFG, when I open the image file in notepad and 
compare it to the original the source is 99.9% identical does anyone have any 
thoughts on why it is not 100% identical? 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345065
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to