uploadFrom

abstract fun uploadFrom(stream: InputStream, fileName: String? = null, mimeType: String? = null)

Uploads data to the endpoint from a stream.

Parameters

stream

The input stream to read the upload data from.

fileName

The name of the uploaded file.

mimeType

The MIME type of the data to upload, nullable.

Throws

when the server responds with HttpStatusCode.BadRequest.

when the server responds with HttpStatusCode.Forbidden.

for other non-success status codes.


open fun uploadFrom(path: String, mimeType: String? = null)

Uploads data to the endpoint from a file.

Parameters

path

The path of the file to read the upload data from.

mimeType

The MIME type of the data to upload, nullable.

Throws

when the file at the specified path can not be read.

when the server responds with HttpStatusCode.BadRequest.

when the server responds with HttpStatusCode.Forbidden.

for other non-success status codes.