---
category: [Administration & Integrations, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions, Platform and Product Extensions/Workday Extend, Platform and Product Extensions/Integration]
keyword: [Extend, Model Components, Attachments, Attachment Objects]
nav: wcp_docs
parent_url: /wcp_docs/
title: >- 
  Concept: Attachment Objects
layout: subsection
---

When you create an attachment object, Workday automatically generates these additional fields that enable you to associate file data with instances of the attachment object:

-   `file`
-   `fileName`
-   `fileLength`
-   `contentType`


Example: You can use the CharityImage attachment object to attach images to the Charity business object.

Workday also provides the <b>File Size</b> report field, secured to the <i>Public Reporting Items</i> domain in the Tenant Non-Configurable functional area. You can use this report field in custom reports or WQL queries to validate the amount of disk space used by a single attachment in your app.

The `file` field stores the attached file or image as a base64-encoded string.

You can write to the `fileName` field by calling the POST and PUT methods of an attachment object API.

The `fileLength` and `contentType` fields are derived from the properties of the attachment object data. You can't write to these fields, but you can call the GET method of the attachment object API to read either of these fields.

If you define additional fields on an attachment object, you must use a content-type of `multipart/form-data` to write to both the file data and the field data in the same API request.

Example: The request `data` includes the additional `SINGLE_INSTANCE` field `"uploadedBy"`.

```
curl -X POST https://api.workday.com/apps/charitableDonations_nkzjqw/v1/charityImages
-H 'authorization: Bearer <token>'
-H 'cache-control: no-cache'
-H 'content-type: multipart/form-data'
-F 'data=
{
    "file":"cid:filedata",  
    "uploadedBy": {
      "id": "Employee_ID=21001"
    },
    "uploadedDate" : "2020-07-01"
}'
-F filedata=@/Users/first.last/Desktop/charityImages/image.jpg
```

<b>Note:</b> The order of the form data matters. If you pass JSON `data` after the `filedata`, you receive a 500 internal server error.

Here's an example of the above cURL request in Postman, which defines the `data` value as:

![](GUID-d5e4ab93-b0ed-41bc-8fd1-e5c9b03aaeb2-enHYPHENus.png)

In order to retrieve file data, call the GET method without any header.

![](GUID-ad4b0ada-a86f-4443-86f8-a65c9479cf0f-enHYPHENus.png)

When you call the GET method on an instance of an attachment object, and you request only the field data (not the file data), you must include the `Accept: application/json` header. If you don't include this header, the request returns the file data without the field data.

![](GUID-6027ad77-8e18-414b-800b-0d57825dfedc-enHYPHENus.png)

<b>Note:</b> The `DELETE` operation on attachment objects doesn't support `bulk=true`.

## <a id="section_ajj_pwy_ktb"></a>Uploading Multiple Files

You can upload multiple files to an attachment object in a single request by appending `Collection` to the endpoint of the attachment object. Example: `POST https://api.workday.com/apps/charitableDonations_nkzjqw/v1/charityImagesCollection`.

In the body of the request, add the file data for each uploaded file to an array. Example:

```
{
   "charityImages": [
      {
         "file": "cid:filedata1",
         "uploadedBy": {
            "id": "989eafee6aa449679fe58caeead36b31"
         },
         "uploadedDate" : "2020-07-01"
      },
      {
         "file": "cid:filedata2",
         "uploadedBy": {
            "id": "989eafee6aa449679fe58caeead36b31"
         },
         "uploadedDate" : "2020-07-01"
      }
   ]
} 
```

The name of the array should be the `name` of the `defaultCollection` of the attachment object. Example:

```
"defaultCollection": {
    "name": "charityImages",
    "label": "All Charity Images"
  }
```

<b>Note:</b> When you use the `fileUploader` widget:

-   Specify the file data in the `metadata` attribute.
-   Ensure that the value of the `singular` attribute is `false`, which is the default.


## <a id="section_p3g_rxd_3sb"></a>Manage Documents

Workday provides the basic functionality that you need to manage documents in your Workday Extend apps. Workday supports:

-   Collecting documents from workers.
-   Linking documents to other Workday objects through `SINGLE_INSTANCE` fields in the metadata of the attachment.
-   Presenting downloadable documents to workers.
-   Securing documents using contextual security.
-   Storing images for Extend app pages.
-   Deleting an attachment.

    <b>Note:</b> The `DELETE` operation on attachment objects doesn't support `bulk=true`.



### Related Information

[Concept: fileUploader](/wcp_docs/ttn1652370891576.html)

[Tutorial: Model Components: Attachments](https://wd5.myworkday.com/workday/learning/course/6827d2f43ff901c21dd08ebaea020296?type=9882927d138b100019b928e75843018d)

[Add Attachment Objects](/wcp_docs/xgx1677268527768.html)

[fileUploader](/wcp_docs/icc1518036830536.html)

[Reference: Workday Extend API Gateways and Authorization Base URLs](/wcp_docs/dlh1653340161856.html)

