Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cfhttp multipart & facebook

I'm playing with the facebook graph api, and was attempting to send an image to my wall. According to facebook, you just send the image, your access key & a caption... see below my code:

<cfoutput>
 <cfif fileexists("D:\myPath\images\menubar.jpg")>
  <cfhttp method="post" url="https://graph.facebook.com/me/photos" multipart="yes">   
   <cfhttpparam type="formfield" name="access_token" value="myAccessToken">
   <cfhttpparam type="file" name="source" file="D:\myPath\images\menubar.jpg">
   <cfhttpparam type="formfield" name="message" value="this is a test picture.">
  </cfhttp>
  <cfdump var="#cfhttp#">
 </cfif>
</cfoutput>

When I run this, I get a 400 bad request error ("OauthException an unknown error occurred" returns from facebook). Does anyone know what I'm doing wrong? Thanks!

like image 572
mistersender Avatar asked Dec 03 '25 06:12

mistersender


1 Answers

can you check your access token format? usually parameters set as access_token=somedata&expires=sometimestamp At the statement you mentioned above, you have to pass just access token literally. I make it bold here. access_token=somedata&expires=sometimestamp

I've been trying to solve the same problem nearly for 3 hours. :) and finally did!

like image 172
Ali Sozkesen Avatar answered Dec 06 '25 21:12

Ali Sozkesen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!