How to upload a file to the server in the iPhone SDK?

I want to send a file to the server on the iPhone. Is there any iPhone API to implement this feature?

+3
source share
2 answers

ASIHTTPRequest is a wrapper for network APIs and very easy to download a file. Here is an example of them (but you can do it on the iPhone too - save the images to a β€œdrive” and then upload them.

ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
[request setPostValue:@"Ben" forKey:@"first_name"];
[request setPostValue:@"Copsey" forKey:@"last_name"];
[request setFile:@"/Users/ben/Desktop/ben.jpg" forKey:@"photo"];
+5
source

Source: https://habr.com/ru/post/1759270/


All Articles