0

I am trying to upload an image to an Amazon EC2 server using AFNetworking for an iOS app. In my research I found this following line to use from here:

[manager POST:@"http://example.com/resources.json" parameters:parameters constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
    [formData appendPartWithFormData:imageData name:@"image"];
} success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"Success: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@"Error: %@", error);
}];

May I know what do I insert accordingly for "parameters"? Is "parameters" the authenticating key between the app and my server? I have an AppKeyPair.pem from the server instance and a username/password to connect to the instance via a remote desktop.

Community
  • 1
  • 1
Evan
  • 1
  • 2
  • oh wait, it seems like AWS has an iOS SDK, so I probably can do this through their SDK? – Evan Dec 25 '15 at 12:09
  • You must see what parameters server expecting in this webservice... If you can see that, edit answer so I can help you. – Stefan Dec 25 '15 at 12:53
  • The AWS SDK is for interacting with the AWS API. It sounds like you are trying to interact with software installed on an EC2 virtual machine. The AWS SDK wouldn't be of any help with that. You definitely don't need to use your AWS key pair or your remote desktop username/password for this. This isn't really even an AWS specific question, just a question of "how to upload an image to a web server via iOS". If you searched for that you will probably find lots of examples, like this one: http://stackoverflow.com/questions/8564833/ios-upload-image-and-text-using-http-post – Mark B Dec 25 '15 at 15:26

1 Answers1

0

I have realised by now that parameters is not needed and can be put as nil if your php side script does not require it, ie, it is purely by requirement of your server side script.

Evan
  • 1
  • 2