title: How to publish facebook photo with multipart/form-data
body: <p>With an Android app, i'm trying to publish a photo to facebook wall, using graph-api reference:
  <a href="https://developers.facebook.com/docs/graph-api/reference/user/photos/" rel="nofollow">https://developers.facebook.com/docs/graph-api/reference/user/photos/</a></p>
  
  <pre><code>Bundle params = new Bundle();
  params.putString("source", "{image-data}");
  /* make the API call */
  new Request(
      session,
      "/me/photos",
      params,
      HttpMethod.POST,
      new Request.Callback() {
          public void onCompleted(Response response) {
              /* handle the result */
          }
      }
  ).executeAsync();
  </code></pre>
  
  <p>I can easily upload picture passing image url to "source" but i want to send multipart/form-data from my FileInputStream WITHOUT uploading to a server.</p>
  
  <p>Someone can explain me how to generate a string from "The photo, encoded as form data"?
  I've tryed this method but it seems doesn't to work:</p>
  
  <pre><code>static final String GetMultipartFormData(InputStream fileInputStream)
  {
      StringBuilder sb = new StringBuilder();
  
      String lineEnd = "\r\n";
      String twoHyphens = "--";
      String boundary =  "*****";
  
      try
      {                       
          sb.append(twoHyphens + boundary + lineEnd);
          sb.append("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"fileName.jpg\"" + lineEnd);
          sb.append(lineEnd);
  
          InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8");
          BufferedReader br = new BufferedReader(inputStreamReader);
          String line;
          while ((line = br.readLine()) != null) {
              sb.append(line);
          }                           
  
          sb.append(lineEnd);
          sb.append(twoHyphens + boundary + twoHyphens + lineEnd);
  
          fileInputStream.close();            
  
      }
      catch (Exception ex)
      {
          ex.printStackTrace();
      }
  
      return sb.toString();
  }
  </code></pre>
  
  <p>Thank you so much.</p>