3

I am trying to post an image to my own profile using the ActionScript SDK.

I have verified that i have the publish_stream and user_photos permissions.

I am logged in and can read Albums and Images.

Using this code:

var bitmap:Bitmap = new Bitmap(bitmapData);
var request:Object = new Object();
request.access_token = Facebook.getSession().accessToken;
request.message = "my message";
request.image = bitmap;
request.fileName = "filename.jpg";
meFacebook.api("/me/photos", postImageToUserCallback, request, URLRequestMethod.POST);

i always see the request failing with a

Error #2032: Stream Error. URL: https://graph.facebook.com/me/photos

I am totally stuck here. What could be the problem and how can i debug this the best way?

Thanks!

DasAntonym
  • 452
  • 3
  • 19
  • ok, here's an update: i am now using this guy's approach of just creating a multipart request http://forum.developers.facebook.net/viewtopic.php?id=58690 but it is still quite unsatisfying that i can't just use the sdk i am using anyway. so any help is still appreciated. – DasAntonym Aug 07 '11 at 16:24

2 Answers2

2

I do this without issue, but with a couple of differences which may or may not make a difference:

Facebook.api(albumID+"/photos",onImagePost,{message:"",image:new Bitmap(myBmd), fileName:''},URLRequestMethod.POST);
  1. I use Facebook.api. What does your meFacebook wrapper do?
  2. I use an album ID rather than me
  3. fileName is an empty string.
shanethehat
  • 15,460
  • 11
  • 57
  • 87
  • that's the weird thing, i tried it with the "me" alias and also with an explicit user id. i also tried it with and without a filename, but no difference. the reason i send it to the user profile instead of an album is because i want the images to land in album created for the app, which is what facebook does automatically when you send it to the profile. did you ever try it that way with the sdk and were successful? as i said, it works when i construct a multipart form request and send it there myself. – DasAntonym Aug 08 '11 at 21:24
  • I certainly tried! http://stackoverflow.com/questions/6611685/posting-image-to-facebook-album-with-as3-api – shanethehat Aug 09 '11 at 08:03
  • While it did post, I found the Facebook did not create an album for me, and instead targeted the first app-created album that already existed. – shanethehat Aug 09 '11 at 08:09
  • that is exactly what i am experiencing now. the weird thing is, some users get it posted properly into an album named after the app and others say it lands in the first. if you only have a profile images album, your profile image actually gets changed. very unpleasant. so i am going to create an album and post it like you already figured out in your post. thanks for the help! – DasAntonym Aug 09 '11 at 21:35
0

I had the exact same error below and it turned out that a link in the "message" parameter was causing the issue.

Error #2032: Stream Error. URL: https://graph.facebook.com/me/photos

We were using a vanity URL (from tinyurl) in the message body. After trying just about everything else, I removed the vanity URL and replaced it with the actual URL and the photo posted with no issues.

And I have no problem creating an album for the app. Facebook automatically creates one if it doesn't exist.

I am using ver 1.8.1 SWC from http://code.google.com/p/facebook-actionscript-api/

This is the code I am using:

var params : Object = {image:bitmap, 'My Message https://www.facebook.com/client?sk=app_##########', fileName:'my_filename.jpg'};
Facebook.api('me/photos', onSaveToPhotoAlbumComplete, params);
shackleton
  • 701
  • 1
  • 12
  • 27