use AFNetworking to upload image


```objectivec
+(void) commonUploadImageWithUrlStr:(NSString*) urlStr
                              param:(NSDictionary*) param
                              image:(UIImage*) image
                           fileName:(NSString*) fileName
                            success:(void (^)(NSDictionary *))successBlock
                            failure:(void (^)(NSError *))failureBlock{
    if(param != nil) {
        NSData *imageData = [[NSData alloc] initWithData:UIImagePNGRepresentation(image)];
        
        if(imageData != nil) {
            AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager];
            NSArray *responseSerializers =@[[AFJSONResponseSerializer serializer]];
            
            manager.responseSerializer = [AFCompoundResponseSerializer compoundSerializerWithResponseSerializers:responseSerializers];
            
            NSMutableURLRequest *request = [manager.requestSerializer multipartFormRequestWithMethod:@"POST"
                                                                                           URLString:urlStr
                                                                                          parameters:param
                                                                           constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
                                                                               [formData appendPartWithFileData:imageData
                                                                                                           name:@"image"
                                                                                                       fileName:fileName
                                                                                                       mimeType:@"image/png"];
                                                                           }
                                                                                               error:NULL];
            
            
            AFHTTPRequestOperation *operation = [manager HTTPRequestOperationWithRequest:request
                                                                                 success:^(AFHTTPRequestOperation *operation, id responseObject) {
                                                                                     NSInteger statusCode = operation.response.statusCode;
                                                                                     
                                                                                     if(statusCode != 201) {
                                                                                         NSLog(@"ERROR statusCode = %ld",(long)statusCode);
                                                                                         if (failureBlock) failureBlock([NSError errorWithDomain:ServerErroDomain code:statusCode userInfo:nil]);
                                                                                     } else {
                                                                                         NSLog(@"%@",responseObject);
                                                                                         if (successBlock) successBlock(responseObject);
                                                                                     }
                                                                                 } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
                                                                                     NSLog(@"%@",error);
                                                                                     if (failureBlock) failureBlock(error);
                                                                                 }];
            
            // データを送信する度に実行される処理を設定する
            [operation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
                // アップロード中の進捗状況をコンソールに表示する
                NSLog(@"bytesWritten: %@, totalBytesWritten: %@, totalBytesExpectedToWrite: %@, progress: %@",
                      @(bytesWritten),
                      @(totalBytesWritten),
                      @(totalBytesExpectedToWrite),
                      @((float)totalBytesWritten / totalBytesExpectedToWrite));
            }];
            
            // アップロードを開始する
            [manager.operationQueue addOperation:operation];
            
        } else {
            if(failureBlock) failureBlock([NSError errorWithDomain:ParamErrorDomain code:9999 userInfo:nil]);
        }
        
    } else {
        if(failureBlock) failureBlock([NSError errorWithDomain:ParamErrorDomain code:9999 userInfo:nil]);
    }
}
```