app提交流信息上传图片到server
server端语言php
回复内容: 如何实现:
app提交流信息上传图片到server
server端语言php
、、、// 1.设置基准路径
afhttpclient *client = [afhttpclient clientwithbaseurl:[nsurl urlwithstring:[nsstring stringwithformat:@%@/buyer/live/uploadimgs,kurlpath]]];// 2.初始化请求参数nsmutabledictionary *dict = [[nsmutabledictionary alloc]init];[dict setobject:imagedata forkey:@images];nsurlrequest *request = [client multipartformrequestwithmethod:@post path:nil parameters:dict constructingbodywithblock:^(id formdata) { // 上传新获得的图片文件 [formdata appendpartwithfiledata:imagedata name:@imgs_file filename:@hao.png mimetype:@image/png];}];// 发送请求上传文件afhttprequestoperation *operation = [client httprequestoperationwithrequest:request success:^(afhttprequestoperation *operation, id responseobject) { nsdictionary *json = [nsjsonserialization jsonobjectwithdata:responseobject options:nsjsonreadingmutableleaves error:nil];} failure:^(afhttprequestoperation *operation, nserror *error) { nslog(@失败);}];[operation start];
、、、
可以看下workerman(一个高性能php socket服务器框架),里面有个例子是接收客户端传输文件的。