<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[`FileManager`](FileManager) › [`getAvailablePathForAttachment`](FileManager/getAvailablePathForAttachment)
## FileManager.getAvailablePathForAttachment() method
Resolves a unique path for the attachment file being saved. Ensures that the parent directory exists and dedupes the filename if the destination filename already exists.
**Signature:**
```typescript
getAvailablePathForAttachment(filename: string, sourcePath?: string): Promise<string>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| <code>filename</code> | <code>string</code> | Name of the attachment being saved |
| <code>sourcePath</code> | <code>string</code> | _(Optional)_ The path to the note associated with this attachment, defaults to the workspace's active file. |
**Returns:**
`Promise``<string>`
Full path for where the attachment should be saved, according to the user's settings