title: Uploading photos to Facebook in ASP.NET Facebook app
body: <p>I've been cracking my head over this and reading all the available docs I can find but still cannot find a solution, so I am posting here. </p>
  
  <p>First, I started here, the official Facebook guide on posting a photo via the Graph API. </p>
  
  <p><a href="https://developers.facebook.com/blog/post/498/" rel="nofollow">https://developers.facebook.com/blog/post/498/</a></p>
  
  <p>Since it's in PHP, I rewrote it in ASP.NET C#. The code works in that the photo was upload successfully, and I got the JSON response with the photo's ID. </p>
  
  <p>I need a way to read this ID back, so I suppose I'd have to do the upload from the server side. However, this would mean that the user will need to upload to my server first, and my code would then send this over to Facebook's API.</p>
  
  <p>My question is: Is there a way to do this without first saving the file to the server's disk? Since at this point of time I'd have a data buffer of the file uploaded, can I somehow send this over to the Graph API? I find it rather redundant to first save the file and then upload again.</p>
  
  <p>I thought of doing this using Javascript/AJAX but there doesn't seem to be a way either. Facebook's Javascript API does not provide for this.</p>
  
  <p>I also tried to look at the various libraries <a href="http://csharpsdk.org" rel="nofollow" title="C-Sharp SDK for Facebook">such as this</a> but the documentation is rather lacking. I also looked at <a href="http://facebooksdk.blogspot.sg/2011/04/facebook-album.html" rel="nofollow">this article</a> but it assumes that I already have a file to upload.</p>
  
  <p>Can the experts here post some sample code for doing this (if it's possible at all) or point me to the correct direction for what I needed. While we are on this, is there a way to trigger Facebook's photo upload dialog or do I have to build my own from scratch?</p>
  
  <p>Thanks a lot in advance.</p>