title: Upload multiple photos on Facebook using Batch Request
body: <p>I had done following code with reference to following <a href="https://stackoverflow.com/questions/5353117/facebook-connect-batch-requests-and-fql-error-problem">link</a> to create batch request for uploading multiple photos in Facebook.</p>
  
  <p>I had got some solution for uploading multiple photos on Facebook through this <a href="http://developers.facebook.com/docs/reference/api/batch/" rel="nofollow noreferrer">Facebook graph API.</a></p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>    NSString *jsonRequest1 = @"{ \"method\": \"POST\", \"relative_url\": \"me/photos\" , \"body\": \"Hello 1\", \"attached_files\": \"file1\" }";
      NSString *jsonRequest2 = @"{ \"method\": \"POST\", \"relative_url\": \"me/photos\" , \"body\": \"Hello 2\", \"attached_files\": \"file2\" }";
      NSString *jsonRequestsArray = [NSString stringWithFormat:@"[ %@, %@ ]", jsonRequest1, jsonRequest2];
      NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:jsonRequestsArray,@"batch",nil];
      [params setObject:UIImagePNGRepresentation(self.image1) forKey:@"file1"];
      [params setObject:UIImagePNGRepresentation(self.image2) forKey:@"file2"];
      [objFacebook requestWithGraphPath:@"me" andParams:params andHttpMethod:@"POST" andDelegate:self];
  </code></pre>
  
  <p>Now when I am running this code I got the following output.</p>
  
  <p><strong>Result Dictionary in</strong> <code>- (void)request:(FBRequest *)request didLoad:(id)result</code></p>
  
  <pre><code>(
          {
          body = "{\"error\":0,\"error_description\":\"File file1 has not been attached\"}";
          code = 400;
          headers =         (
                          {
                  name = "HTTP/1.1";
                  value = "400 Bad Request";
              },
                          {
                  name = "Content-Type";
                  value = "text/javascript; charset=UTF-8";
              }
          );
      },
          {
          body = "{\"error\":0,\"error_description\":\"File file2 has not been attached\"}";
          code = 400;
          headers =         (
                          {
                  name = "HTTP/1.1";
                  value = "400 Bad Request";
              },
                          {
                  name = "Content-Type";
                  value = "text/javascript; charset=UTF-8";
              }
          );
      }
  )
  </code></pre>
  
  <p>I don't know how this files attached.. Can anyone help me to figure out this problem.</p>
  
  <p>Is there any change in my code then please let me know.</p>
  
  <p>Thanks in advance...</p>