Upload()

Upload a file attachment

Description

Uploads a file attachment.

Notes

The file name must start with a letter or a number, and can have the following special characters:

  • A space

  • ,

  • _

  • .

File extension must at least have two letters for the file extension.
This is the regular expression used to validate the file names: ^[a-zA-Z0-9][a-zA-Z0-9, -,_.]*.[A-Za-z]{3,}$

Virus Scan

All files are scanned for viruses using the OSWAT MetaDefender version 4.

File size limit

The limit is for a file attachment is 200MB.

Package Details

Interface

IFileAttachmentManager

Syntax

await fileAttachmentManager.Upload( FileAttachment fileAttachment );

Returns

Task<FileAttachment>

API

POST
/api/v1/file-attachments

Parameters

Parameter

Description

Parameter Type

Parameter

Description

Parameter Type

serviceRequestId

The service request id

path

filename

The file attachment name

path

contentType

The file content type (ex: image/jpeg)

path

size

The size of the file attachment

path

metadefenderHash (optional)

MetaDefender Core MD5 Hash

path

attachment

the byte array of the file attachment

request body

Returns

200 OK - File Attachment

Example

byte[] bytes = System.Text.Encoding.ASCII.GetBytes("Hello world!"); int serviceRequestId = 123; var fileAttachment = new FileAttachment { ContentType = "text/plain", Data = bytes, Name = "HelloWorld.txt", ServiceRequestId = ServiceRequestId, Size = bytes.Length }; var newAttachment = await _fileAttachmentManager.Upload(fileAttachment);