I need to upload audio file recorded in iOS device to server using PUT
method in request. Now, I am confused that is it possible to upload audio file to server without multipart request in iOS Swift.
Is it possible to upload audio file to server using put request (Not multipart request) in iOS Swift
Asked
Active
Viewed 475 times
0
3 Answers
0
you can convert to base64 string and repeat call put if server can accept base64 request , if server can’t accept that you can’t. see documentation or contact server developer to find a way both can compatible.

Hamed Hosseini
- 182
- 2
- 13
0
Create an URLRequest with a PUT method:
var request = URLRequest(url: url)
request.httpMethod = "PUT"
And then upload your data:
let task = URLSession.shared.uploadTask(with: request, from: data)
task.resume()
There's no need for a multipart if the server doesn't want hat.

Rob Napier
- 286,113
- 34
- 456
- 610
-
-
Your question is about how to PUT data, but your real problem is that you actual problem is around misusing this server API. We don't know what the server is, so probably can't help you without that without details of the API. – Rob Napier Jan 29 '21 at 14:06
SignatureDoesNotMatch