java - ColdFusion cfhttp looses metadata in uploading docx file -
i having problem uploading docx file. looses 2 bytes after upload , save server. here code.
<cffunction name="akamaiupload" access="private" output="false"> <cfargument name="filename" type="string" required="true"> <cfargument name="localpath" type="string" required="true"> <cftry> <cfhttp url="http://sample.com/#arguments.filename#" method="post"> <cfhttpparam type="file" name="user_file" file="#arguments.localpath#" /> </cfhttp> <!--- catch error, return error message ---> <cfcatch type="any"> <cfreturn #cfcatch.message#> </cfcatch> </cftry> </cffunction>
i've found code same issue , tried apply solution still didn't work. here code.
<cffunction name="akamaiupload" access="private" output="false"> <cfargument name="filename" type="string" required="true"> <cfargument name="localpath" type="string" required="true"> <cffile action="readbinary" file="#arguments.localpath#" variable="myfile"> <cfset by=createobject("java","java.lang.string")> <cfset by.init(myfile, "iso-8859-1")> <cfset contentdivider=hash("this divider this")> <cfhttp method="post" url="http://sample.com/#arguments.filename#" charset="iso-8859-1"> <cfhttpparam type="header" name="content-type" value="multipart/form-data; boundary=#contentdivider#"> <cfhttpparam type="header" name="accept-encoding" value="deflate;q=0"> <cfhttpparam type="header" name="te" value="deflate;q=0"> </cfhttp> <!--- returning true successful upload ---> <cfreturn true> </cffunction>
has here experienced same issue? please share suggestions.