Sorry, we use our GitHub project for bug reports and feature requests. In the future, you should open questions like this on Stack Overflow and tag alamofire.
Cheers. 馃嵒
From our Contribution Guidelines
We don't use GitHub as a support forum. For any usage questions that are not specific to the project itself, please ask on Stack Overflow instead. By doing so, you'll be more likely to quickly solve your problem, and you'll allow anyone else with the same question to find the answer. This also allows maintainers to focus on improving the project for others.
@dp4dileep Here's an example:
// provide here the image that you want to upload,
// and a value between 0 and 1 where 1 is the highest quality
// https://developer.apple.com/reference/uikit/1624115-uiimagejpegrepresentation
let imageData = UIImageJPEGRepresentation(image, 0.8)
let url = yourUrl
Alamofire.upload(multipartFormData: { multipartFormData in
multipartFormData.append(imageData!, withName: "photo", fileName: "photo.jpeg", mimeType: "image/jpeg")},
to: url,
encodingCompletion: { encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.responseJSON { response in
// your implementation
}
case .failure(let encodingError):
// your implementation
}
})
Most helpful comment
@dp4dileep Here's an example: