Recently i am developing the IOS app, a feature is needed to upload image to the webservice server. I am using the AFNetworking library. The function is as follow.

-(void)SendImage:(NSData *)imgData {

NSDictionary *parameters = @{@"ShopID": [NSString stringWithFormat:@"%d", 1],

@"ImageID": @"0"

};

NSString *szAddress = utilityGetRequestAddress( EASYQ_CMD_UPLOAD_IMAGE );

httpRequestManager.responseSerializer = [AFJSONResponseSerializer serializer];

[httpRequestManager POST:szAddress parameters:parameters constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {

[formData appendPartWithFormData:imgData name:@"ShopImage"];

} success:^(AFHTTPRequestOperation *operation, id responseObject) {

NSLog(@"Success: %@", responseObject);

} failure:^(AFHTTPRequestOperation *operation, NSError *error) {

NSLog(@"Error: %@", error);

}];

}

There is one thing need to be noticed. In the server side, i am using Slim framework, when i try to using variable $_FILES["ShopImage"] to get the image, it returns null. Finally i found i need to use $app->request->post('ShopImage') to get the image data.

Using AFNetWorking 2.0 upload file to php web service server based on Slim的更多相关文章

  1. ASP.NET4.0中JavaScript脚本调用Web Service 方法

    环境:VS2019  .net 4.0 framework 根据教材使用ScriptManager在JavaScript中调用Web service 时,失败.现将过程和解决方法记录如下: 1.定义W ...

  2. AFNetworking 3.0.4 的使用

    本文永久链接:http://www.cnblogs.com/qianLL/p/5342593.html pod 'AFNetworking', '~>3.0.4'    <-------第 ...

  3. AFNetworking 2.0使用(持续更新)

    本人视频教程系列 导入AFNetworking 2.0 文件夹,引入头文件AFNetworking.h --------------- *使用NSURLSessionDownloadTask来下载一张 ...

  4. [翻译] AFNetworking 2.0

    大名鼎鼎的开源网络库AFNetworking 2.0,目前只是翻译了Github上的链接文章,使用教程请点击 http://www.cnblogs.com/YouXianMing/p/3651462. ...

  5. AFNetworking 3.0 源码解读(三)之 AFURLRequestSerialization

    这篇就讲到了跟请求相关的类了 关于AFNetworking 3.0 源码解读 的文章篇幅都会很长,因为不仅仅要把代码进行详细的的解释,还会大概讲解和代码相关的知识点. 上半篇: URI编码的知识 关于 ...

  6. AFNetworking 3.0 源码解读(五)之 AFURLSessionManager

    本篇是AFNetworking 3.0 源码解读的第五篇了. AFNetworking 3.0 源码解读(一)之 AFNetworkReachabilityManager AFNetworking 3 ...

  7. jQuery文件上传插件jQuery Upload File 有上传进度条

    jQuery文件上传插件jQuery Upload File 有上传进度条 jQuery文件上传插件jQuery Upload File,插件使用简单,支持单文件和多文件上传,支持文件拖拽上传,有进度 ...

  8. AFNetworking 3.0 版本使用

    原创:http://www.zhimengzhe.com/IOSkaifa/38653.html AFNetworking 3.0 版本使用 在Xcode7.0之后,苹果废弃了NSURLConnect ...

  9. Upload file

    <h3>Upload File</h3> <form action="@Url.Action("Upload","UploadCo ...

随机推荐

  1. GCD的基本知识

    什么是GCD 全称是Grand Central Dispatch,可译为“牛逼的中枢调度器” 纯C语言,提供了非常多强大的函数 GCD的优势 GCD是苹果公司为多核的并行运算提出的解决方案 GCD会自 ...

  2. Oracle帮助类

    /// <summary> /// Copyright (C) Maticsoft /// 数据访问基础类(基于Oracle) /// 可以用户可以修改满足自己项目的需要. /// < ...

  3. 网络数据包收发流程(三):e1000网卡和DMA

    一.硬件布局每个网卡(MAC)都有自己的专用DMA Engine,如上图的 TSEC 和 e1000 网卡intel82546.上图中的红色线就是以太网数据流,DMA与DDR打交道需要其他模块的协助, ...

  4. Erlang 104 OTP

    笔记系列 Erlang环境和顺序编程Erlang并发编程Erlang分布式编程YawsErlang/OTP 日期              变更说明 2014-12-21 A Outline, 1 A ...

  5. std::ostringstream输出流详解

    一.简单介绍 ostringstream是C++的一个字符集操作模板类,定义在sstream.h头文件中.ostringstream类通常用于执行C风格的串流的输出操作,格式化字符串,避免申请大量的缓 ...

  6. java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

    因为同样的方法在java中没有问题,放到web工程中就出现了问题.网上查到的资料,说只要把mysql-connector-java-5.1.7-bin.jar放入tomcat中的lib文件夹就可以.很 ...

  7. 用ABBYY提取文本和表格的方法

    在ABBYY FineReader 12 OCR文字识别软件中,有一个插件ABBYY Screenshot Reader,通常情况下与ABBYY FineReader 12一起安装到计算机中,它是一款 ...

  8. 27个知名企业品牌VI视觉识别系统规范手册

    Apple公司视觉设计规范 微软公司VI视觉系统 星巴克企业视觉规范手册 DELL品牌VI视觉手册 MTRADING品牌视觉规范 KFC视觉设计规范手册 麦当劳视觉规范 LEGO乐高玩具的品牌视觉规范 ...

  9. knockout 学习实例6 attr

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  10. nova boot instance call flow

    参考http://www.cnblogs.com/popsuper1982/p/3927390.html