Alamofire4.0之上传图片

Alamofire.upload(multipartFormData: { (formData) in
formData.append(data, withName: "file", fileName: "showImage.png", mimeType: "image/png")
for item in (paramTwo.keys) {
let value = paramTwo[item] as! String
let valuedata = value.data(using: .utf8)!
formData.append(valuedata, withName: item)
}
}, to: url!) { (result) in
switch result{
case .success(request:let upload, streamingFromDisk: false, streamFileURL: _):
upload.responseJSON(completionHandler: { (response) in
if let value = response.result.value {
let dict = JSON(value)
} else {
}
})
break
case .failure( _):
delegate.requestFailResultValue(index: index)
break
default:
delegate.requestFailResultValue(index: index)
break
}
}

你可能感兴趣的:(Alamofire4.0之上传图片)