addAttachment

suspend fun addAttachment(name: String, contentType: String, filePath: String): Result<FormAttachment>

Adds a new attachment to this AttachmentsFormElement from the specified file.

Return

A Result containing the new FormAttachment. A FileNotFoundException will be set on the Result if the file at filePath does not exist.

Since

300.0.0

Parameters

name

The name of the Attachment.

contentType

The type of content.

filePath

Path to a file that will be used for the attachment's content.


fun addAttachment(name: String, contentType: String, data: ByteArray): FormAttachment

Adds a new attachment to this AttachmentsFormElement.

Return

The new FormAttachment.

Since

200.5.0

Parameters

name

the name of the attachment

contentType

the mime type of the attachment

data

the attachment data

Throws

if data is empty