## MedplumClient.createAttachment() method

> Warning: This API is now obsolete.
>
> Use `createAttachment` with `CreateBinaryOptions` instead. To be removed in a future version.

**Signature:**

```typescript
createAttachment(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void, options?: MedplumRequestOptions): Promise<Attachment>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| data | [BinarySource](/content/docs/sdk/core.binarysource) | The binary data to upload. |
| filename | string \| undefined | Optional filename for the binary. |
| contentType | string | Content type for the binary. |
| onProgress | (e: ProgressEvent) => void | _(Optional)_ Optional callback for progress events. **NOTE:** only `options.signal` is respected when `onProgress` is also provided. |
| options | [MedplumRequestOptions](/content/docs/sdk/core.medplumrequestoptions) | _(Optional)_ Optional fetch options. **NOTE:** only `options.signal` is respected when `onProgress` is also provided. |

**Returns:**

Promise<Attachment>

The result of the create operation.

- [MedplumClient.createAttachment() method](/content/docs/sdk/core.medplumclient.createattachment_1#medplumclientcreateattachment-method/index.html)
- [Parameters](/content/docs/sdk/core.medplumclient.createattachment_1#parameters/index.html)
