iOS 发送http请求时,需要发送图片或者视频等大容量数据内容,使用输入流是最佳的选择
NSURL *url = [NSURL URLWithString:@""]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; NSInputStream *insetream = [NSInputStream inputStreamWithFileAtPath:@"路径"];//添加文件路径 [request setHTTPBodyStream:insetream]; [request setHTTPMethod:@"POST"];
原文地址:http://blog.csdn.net/u010123208/article/details/40393493