标签:
ASIHTTPRequest 上传框架支持文件;
使用文件上传ASIFormDataRequest;
NSString *s = @"文件传输"; NSURL *url = [NSURL URLWithString:@"http://localhost:8080/text"];//传输地址 ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingMacChineseSimp);//编码格式 [request setStringEncoding:enc]; [request setPostValue:s forKey:@"title"]; [request setFile:@"Users/...." forKey:@"文件名称"]; [request setDelegate:self]; [request setDidFinishSelector:@selector(Finish)];//完毕时调用的函数 [request setDidFailSelector:@selector(Fail )];//失败时调用的函数 [request startSynchronous];//開传递开始
版权声明:本文博客原创文章。博客,未经同意,不得转载。
标签:
原文地址:http://www.cnblogs.com/gcczhongduan/p/4626365.html