for key in (parameter?.keys)!{
let v:String = parameter![key] as! String
let vd:Data = v.data(using:String.Encoding.utf8)!
MultipartFormData.append(vd, withName: key)
}
let data: Data = UIImageJPEGRepresentation(image, 0.1)!//image
MultipartFormData.append(data, withName: "myfiles" ,fileName:"1.jpg",mimeType:"image/jpg")
上面是构造的上传参数
下面是全部代码
网友评论