0

It seems that there are no objective-c libraries that you can import that are equivalent to the apache libraries android for android.

So what is the best way to send a video file to server from an iOS app if I'd like to use the same php POST script?

If I use NSMutableRequest, how can I emulate the multipartentity? Would the following blocks of code be equivalent?

multipartentity.addpart("file", new FileBody(file));
mulitpartentity.addpart("form_submitted", new StringBody("true"));

&

NSMutableData *body = [NSMutableData data];
NSMutableString *str = [[NSMutableString alloc] init];   
[str appendFormat:@"file=%@", self.fileData];
[str appendFormat:@"&form_submitted=%@", @"true"];

[body appendData:[postString dataUsingEncoding:NSUTF8StringEncoding]];

[theRequest setHTTPBody:body];
Jaronimo
  • 3
  • 1
  • 6

1 Answers1

2

If you want to use a multipart entity type functionality in iOS you have to use a third party libraries --- ASIHttpRequest Libraries !

Download it from Here

You have to use ASIFormDataRequest Class for implementing the multipart entity type functionality, which is included in the ASIHttpRequest Library...

Also see the following Post

Also if u need you can refer this Blog

Hope it Helps !!

Community
  • 1
  • 1
Gurvinder
  • 21
  • 5