---
description: Uploads an attachement
---

# uploadAttachment

## Parameters

* data - The data as blob
* documentTypeId (optional) - The ID of the document type to be saved
* fileName - (optional) name of the attachment
* appName - (optional) name of the app config
* recordId - (optional) The ID of the record of the app config

The purpose of parameters 'appName' and 'recordId' is to allow attaching an attachment to any record of any app. However, both parameters must be passed for this purpose. If one or both of them are missing, the uploaded attachment always refers to the currently opened record.

## Example Usages

```javascript
//Default
app.uploadAttachment(blobData, 1, "attachement.jpg");
```

```javascript
//Upload blobData to record 4711 of app customerOrder 
//regardless of which open app you are currently in.
app.uploadAttachment(blobData, 1, "attachment.jpg", "customerOrder", 4711);
```
