您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

app上传图片

2025/3/6 16:23:20发布20次查看
如何实现:
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服务器框架),里面有个例子是接收客户端传输文件的。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product