通过file形式上传图片

[manager POST:Interface_AddDeviceFailure parameters:paramDic constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData) {
        
    
        NSData *data = UIImageJPEGRepresentation(_currentImg, 0.5);
        
        [formData appendPartWithFileData:data name:@"files" fileName:@"test.jpg" mimeType:@"image/jpg"];
    } progress:^(NSProgress * _Nonnull uploadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
        
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error)           {
        
    }];

  

posted @ 2017-04-26 15:44  iWillW  阅读(288)  评论(0编辑  收藏  举报