> For the complete documentation index, see [llms.txt](https://support.docstudio.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.docstudio.com/user/scenarios/condition-types/attachment-reuse.md).

# ​Attachment Reuse

You can re-use attachments uploaded in a previous scenario step. To do this, get the attachment UUID from the source envelope and set it for the respective attachment in the target envelope.

You can’t use the same attachment UUID more than once in the same envelope. Attachment re-use works only for envelopes created via scenarios.

**Source envelope**

Example source envelope:

{% code title="source-envelope.xml" lineNumbers="true" %}

```xml
<envelope templateUuid="bd6c94c9-715f-4611-bcb0-cc4114cff83d" templateVersion="bd6c94c9-715f-4611-bcb0-cc4114cff83d">
        <info>
                <subject>envelope subject</subject>
                <message/>
                <forwarding delegation="true" sharing="true"/>
        </info>
        <flow>
                <roles>
                        <role id="e1bcbffa-aed6-4022-baef-40dee2da8cef" mailboxUuid="8dcde243-a918-444a-ac7d-44ac88554769"/>
                        <role id="bc749581-1685-4650-8e91-f2c7187d7223" mailboxUuid="8dcde243-a918-444a-ac7d-44ac88554769"/>
                </roles>
        </flow>
    <documents>
                <document id="aa620e04-852b-4ae4-85d4-833f5fdfc79f">
                        <field name="File 1" attachmentUuid="5c03bf5e-b2f3-44bb-b313-eb432830189d">zipFileName.zip</field>
                </document>
                <document id="fc246044-bfa5-4224-8329-7656280ac45c">
                        <field name="b70d61fa-4805-4e7b-9561-aa1f4f5c653f" attachmentUuid="e3760a4e-4c7b-4323-aa7b-60a4351ba8ef">pdfFileName.pdf</field>
                </document>
        </documents>
</envelope>
```

{% endcode %}

To re-use attachments from the source envelope, use one of these patterns:

{% code title="attachment-reuse-select.xslt" lineNumbers="true" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        ...
        <field name="File 1">
            <xsl:attribute name="attachmentUuid" select="envelope/documents/document/field[@name='b70d61fa-4805-4e7b-9561-aa1f4f5c653f']/@attachmentUuid"/>
        </field>
        ...
    </xsl:template>
</xsl:stylesheet>
```

{% endcode %}

Or:

{% code title="attachment-reuse-variable.xslt" lineNumbers="true" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        ...
                    <xsl:variable name="att1Uuid" select="envelope/documents/document/field[@name='b70d61fa-4805-4e7b-9561-aa1f4f5c653f']/@attachmentUuid"/>
        <field name="File 1" attachmentUuid="{$att1Uuid}"></field>
        ...
    </xsl:template>
</xsl:stylesheet>
```

{% endcode %}
