Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not able to upload photo #6

Open
parindam opened this issue Sep 16, 2011 · 3 comments
Open

not able to upload photo #6

parindam opened this issue Sep 16, 2011 · 3 comments

Comments

@parindam
Copy link

Hi,

I tested and found fb.api for "/me/feed" works perfectly in node.js server. But when I tried to use the graph api for "/me/photos" as mentioned in http://developers.facebook.com/docs/reference/api/album/, I got the error. That is because it expects the source to be in "multipart/form-data". But in my case I am getting the file in server in tmp filesystem. How can I get it in "multipart/form-data" ? I am using "'connect-form'" with express to get the data from client to server and it gets saved as /tmp/files...
..............
app.post('/', function(req, res, next){

req.form.complete(function(err, fields, files){
if (err) {
next(err);
} else {

  fb.apiCall('POST', '/me/photos',
    {access_token: fields.access_token, message: fields.message, source:files.source},
    function (error, response, body) {
        if (error) {
            console.log('Error in facebook Photo UPLOAD', error);
            return;
        }
      console.log('facebook RESPONSE :', response);
      console.log('facebook BODY :', body);
      res.redirect('back');
      //res.render('done', {body: body});
    }
  );

}

});

@nfriedly
Copy link

nfriedly commented Apr 3, 2012

I'd like to do exactly this, did you ever come up with a solution parindam?

@parindam
Copy link
Author

parindam commented Apr 4, 2012

nfriedly, no I did not check it later on.
I changed the idea of uploading images in FB.

As a sidenote, you can very well upload it to amazon s3. It's pretty good and not so expensive as well and the module to look out for would be knox.

@nfriedly
Copy link

nfriedly commented Apr 4, 2012

Thanks! I might just do that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants