Uploading a Photo using Graph API

353 views
Skip to first unread message

Jon D

unread,
May 24, 2012, 5:22:18 PM5/24/12
to mini_fb
Hello,
I'm attempting to use mini_fb to upload a photo to a facebook users
album.

I see in the documentation how to do so using the old API:
@fb.call("photos.upload", "file_name"=>"full path to file")

However, I can't get it to work using the graph api doing something
like:
MiniFB.post(facebook_token,facebook_id, { :type => 'photos', :source
=> file_path, :width => 800, :height => 374 })

This is the error response:
url_post=https://graph.facebook.com/100002747083125/photos
ex.http_code=400
ex.http_body={"error":{"message":"(#324) Requires upload
file","type":"OAuthException","code":324}}
MiniFB::FaceBookError: Facebook error 400: OAuthException: (#324)
Requires upload file

Looking at the code, there doesn't seem to be anything setting the
enc_type to "multipart/form-data", of course I could be missing
something. I doubt I'm the first one to try to do this. Any
suggestions?

Thanks,

- jon
Reply all
Reply to author
Forward
0 new messages