导入ASIHTTP
使用ASIFormDataRequest
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];//接口url
_asiRequest = request;//一定要有活的对象在request的生命周期对request持有强引用
UIImage *image = [UIImage imageWithContentsOfFile:imagePath];//从本地文件读图片到内存
NSData *data = UIImagePNGRepresentation(image);//转为nsdata对象
[_asiRequest addData:data withFileName:fileName andContentType:contentType forKey:key];//这个相当于HTML表单中的文件
[request setPostValue:@"xxx" forKey:@"xxx"];//这个相当于HTML表单中的值
request.delegate = self;
[_asiRequest startAsynchronous];