alamofirealamofire5

Is it possible to have smaller packets when uploading images in Alamofire?


my code is something like this:

Alamofire.upload(multipartFormData: { (data) in 
  // add bunch of large size images 
}
.uploadProgress { progress in
  // print progress
}
.downloadProgress { progress in
  // print progress
}

the problem is that uploadProgress takes too long to refresh compared to downloadProgress

is there any way to make uploadProgress update more frequently?

btw: im using alamofire 5


Solution

  • No. Alamofire is at the mercy of the progress callbacks from URLSession. You should also know that if your upload is over the threshold, it's first written to disk, which is not reflected in the progress. So you'll see a period of no progress, then the real upload progress, then quick download progress, as the download part is usually just the server acknowledging the upload and is much smaller.