You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to upload file to server and listen to uploading progress. I've written this code:
structStorageUploaderAPI:SignedTargetType{letbaseURL:URLletfileURL:URLletblobLength:Int// file lengthletuploadedSize:Int// I should start uploading file from this byteletmethod=Moya.Method.put
letpath=""init(baseURL:URL, fileURL:URL, blobLength:Int, uploadedSize:Int){self.baseURL = baseURL
self.fileURL = fileURL
self.blobLength = blobLength
self.uploadedSize = uploadedSize
}vartask:Task{.uploadFile(fileURL)}varapiHeaders:[String:String]{...}}
But it doesn't`t work if I should start uploading file from for example 100th byte.
So I changed creating task to this:
vartask:Task{vardata=try?Data(contentsOf: fileURL)
if uploadedSize >0{
data = data?.subdata(in: uploadedSize..<blobLength)}return.requestData(data ??Data())}
But .requestData doesn't`t allow me to listen to progress of the request.
Which case of Task should I use in order to be able to upload file from a specific byte and to listen to uploading progress?
The text was updated successfully, but these errors were encountered:
Hi! I am using 15.0.0 version of Moya.
I need to upload file to server and listen to uploading progress. I've written this code:
But it doesn't`t work if I should start uploading file from for example 100th byte.
So I changed creating task to this:
But
.requestData
doesn't`t allow me to listen to progress of the request.Which case of Task should I use in order to be able to upload file from a specific byte and to listen to uploading progress?
The text was updated successfully, but these errors were encountered: