扫码关注官方订阅号
请问,怎么上传HTTP的图片,据说要把图片转化为二进制流的然后提交服务器上传,还要遵循multipark/from-data这个请求类型的,还有带自己想带的很多参数,会的请教下,真的不会了,谢谢。
小伙看你根骨奇佳,潜力无限,来学PHP伐。
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; SetAFHttpManger(manager, YES); [self HUDShow:@"正在上传头像"]; __weak typeof(self) safeSelf = self; [manager POST:BASE_HOST(REQUEST_EDIT_HEAD_IMAGE) parameters:dictionary constructingBodyWithBlock:^(id <AFMultipartFormData> formData) { NSData *data = UIImagePNGRepresentation(currentHeadImage); [formData appendPartWithFileData:data name:@"headImage" fileName:@"headImage.png" mimeType:@"image/png"]; } success:^(AFHTTPRequestOperation *operation, id responseObject) { NSString *string = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; NSDictionary *dictionary1 = [string objectFromJSONString]; if (dictionary1) {
http://blog.csdn.net/ios_apple/article/details/32321737明天试试这个。
用ALAsset的defaultRepresentation方法获取data流,参考:为七牛iOS SDK添加ALAsset上传支持
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
http://blog.csdn.net/ios_apple/article/details/32321737明天试试这个。
用ALAsset的defaultRepresentation方法获取data流,参考:为七牛iOS SDK添加ALAsset上传支持