---
title: "attachFile"
canonical: "https://support.appfire.com/space/PSJ/15485806/attachFile"
format: markdown
---
> Macro (aura-html)


|  |  |  |  |
| --- | --- | --- | --- |
| **Syntax** | attachFile(path_to_file, issue) | **Package** |  |
| **Alias** |  | **Pkg Usage** |  |

## Description

> Macro (excerpt)
> 
> Add an attachment to a selected issue.

Add an attachment to a selected issue.

## Parameters

| Parameter name | Type | Required | Description |
| --- | --- | --- | --- |
| path to file | String | Yes | Absolute path to the file. |
| issue key | String | Yes | Key of the issue the file will be attached to. |

## Return Type

**Boolean**

The return value represents the success of the attachment process. If the function returns "true" the file was attached successfully.

## Example

```
string path_to_file;
string issue;
path_to_file = "C:/jira/home/attachment/file_to_attach_1.jpg";
issue = "PRJ-239";
attachFile(path_to_file, issue);
```

Result: Returns "true" if the file is at the selected location and the issue exists. It means the file was attached. Returns "false" if any of the conditions stated before are not met.

> ⚠️ 1. Use forward slashes ("/") for the path.
> ⚠️ 2. The path to the attachment must be absolute and point to a location on the server.
> ⚠️ 3. If an error occurs, the function will return "false" and the error message will be visible in the log.

## See also

> Macro (contentbylabel)