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

后端 未结 2 1000
隐瞒了意图╮
隐瞒了意图╮ 2020-12-21 06:43

I want to send a file to server in iPhone. Is there any iPhone API to implement that functionality?

相关标签:
2条回答
  • 2020-12-21 07:35

    ASIHTTPRequest is a wrapper around the network APIs and makes it very easy to upload a file. Here's their example (but you can do this on the iPhone too - save images to "disk" and later 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"];
    
    0 讨论(0)
  • 2020-12-21 07:37

    This tutorial will let you upload files to server

    0 讨论(0)
提交回复
热议问题