If anyone is interested in helping out, I was able to recreate this issue in
the cffile portion of ColdFusion, if you read in a jpg using cffile "read" and
then save it using cffile, you will get the same munged image, if you read it
in using cffile "readbinary" and save it, it works perfectly.
So, the question is, is there a way to force "getHTTPRequestData().content" to
be read in as binary?
Unfortunately, there is no "Content-Type" in the request header and I have the
feeling that CF is reading this as "Text" by default.
thank you in advance, Fred
> Here is the scenario.
> I have a 3D app that will "post" a render in jpg format to the URL of
> my choice, in this case I have setup a server (I have tested with CF9
> and Railo) on my machine to test catching the JPG's and saving them to
> the hard drive.
> The problem is that the photos come through all messed up. So here is
> the PHP example that works just fine:
> <?
> if (!($fp = fopen("c:\\hello.jpg", "ab+"))) {
> echo "<error>Cannot create file</error>";
> }
> fwrite($fp, "$HTTP_RAW_POST_DATA");
> fclose($fp);
> ?>
>
> here is my CFML:
> <cffile action="write" file="c:/cfHello.jpg"
> output="#getHTTPRequestData().content#" addnewline="false">
>
> A little research has turned up the following:
> If I look at the POST in HTTPDebugger, I can see the Binary data that
> is being sent.
> And if I open up the two jpg's in a hex editor I can see that the PHP
> version has the correct content length and the bytes are all the
> correct.
> When I open up the Railo version, the content length is correct, and
> a
> lot of the bytes are the same but some are different. here is a short
> example.
> CF:
> 7B 8A 3F 63 EC FE 27 29
> PHP:
> 7B 8A 8F 63 EC FE 27 29
>
> I appologize that I cannot provide a place for you to trigger the post
> for testing, but I am hoping someone may have some ideas on how to
> solve this issue.
> Any information you can give me would be appreciated, I was hoping to
> do this in CF so I can do some additional cfimage work on the jpg,
> Thanks.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327097
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4