title: Facebook Graph API - upload photo using JavaScript
body: <p>Is it possible to upload a file using the Facebook Graph API using javascript, I feel like I'm close.  I'm using the following JavaScript</p>
  
  <pre><code>var params = {};
  params['message'] = 'PicRolled';
  params['source'] = '@'+path;
  params['access_token'] = access_token;
  params['upload file'] = true;
  
  function saveImage() {
      FB.api('/me/photos', 'post', params, function(response) {
          if (!response || response.error) {
              alert(response);
          } else {
              alert('Published to stream - you might want to delete it now!');
          }
      }); 
  }
  </code></pre>
  
  <p>Upon running this I receive the following error...</p>
  
  <pre><code>"OAuthException" - "(#324) Requires upload file"
  </code></pre>
  
  <p>When I try and research this method all I can find out about is a php method that apears to solve this</p>
  
  <pre><code>$facebook-&gt;setFileUploadSupport(true);
  </code></pre>
  
  <p>However, I am using JavaScript, it looks like this method might be to do with Facebook Graph permissions, but I already have set the permissions user_photos and publish_stream, which I believed are the only ones I should need to perform this operation.</p>
  
  <p>I have seen a couple of unanswered questions regarding this on stackoverflow, hopefully I can explained myself enough. Thanks guys.</p>