Before Alamofire5 we could user encodingReesult of uploadRequest to get uploadProgress
.
But now after uploading Alamofire to version 5, based on Alamofire Documentation, we can use .uploadProgress
in order to get upload progress handler.
Here's my code:
AF.upload(multipartFormData: { multipartFormData in
multipartFormData.append(fileContent, withName: "file", fileName: filePath.lastPathComponent)
multipartFormData.append(token.data(using: .utf8)!, withName: "token")
}, to: uploadURL)
.uploadProgress { progress in
print(progress)
}
.responseJSON { [weak self] response in
print(response)
}
But uploadProgress
closure never called during upload progress.
I've checked many stackoverflow
questions but no one worked.