# Upload Attachment

**URL:** <https://forums.pega.com/t/upload-attachment/1656>\
**Category:** User Experience\
**Tags:** 8-4, user-experience, lead-system-architect\
**Created:** [August 20, 2021, 2:27am UTC](https://forums.pega.com/t/upload-attachment/1656 "2021-08-20T02:27:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_Mondal](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/abhishek_mondal/32/11341_2.png) [@Abhishek\_Mondal](https://forums.pega.com/u/Abhishek_Mondal)\
**Post date:** [August 20, 2021, 2:27am UTC](https://forums.pega.com/t/upload-attachment/1656/1 "2021-08-20T02:27:35Z")

</div>

To upload attachment, we need the instance key of the work object. But, In case of Temporary Work object – there is no instance created until it’s persisted.

The Pega OOTB attachments rules, requires an instance key to open the work object and save the attachments.

Is there any way, we can upload attachments successfully in temporary work object or is there some other solution.

---

<div class="post-metadata">

**Author:** ![VikashK99](https://avatars.discourse-cdn.com/v4/letter/v/c37758/32.png) [@VikashK99](https://forums.pega.com/u/VikashK99)\
**Post date:** [August 20, 2021, 4:31am UTC](https://forums.pega.com/t/upload-attachment/1656/2 "2021-08-20T04:31:03Z")

</div>

@Abhishek_Mondal

you can use pxFileUpload control. When using this control you need to create one section that has a control that executes ‘PopupFileBrowser(ev)’ function and an activity like @baseclass.pzUploadFile. The files selected this way are uploaded to the file system but not yet saved in the database. pzUploadFile activity keeps uploaded file information in Primary.pyUploadedFile clipboard page of class Data-WorkAttach-File. When you create an actual case, you can use this pyUploadedFile page and attach a file to the case using one of the OOTB attachment activities which should be as simple as →

Obj-Save pyUploadedFile  
Call Work-.pxLinkAttachmentToCase

Regards

Vikash

---

<div class="post-metadata">

**Author:** ![Abhishek\_Mondal](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/abhishek_mondal/32/11341_2.png) [@Abhishek\_Mondal](https://forums.pega.com/u/Abhishek_Mondal)\
**Post date:** [August 30, 2021, 3:56am UTC](https://forums.pega.com/t/upload-attachment/1656/3 "2021-08-30T03:56:35Z")

</div>

Thanks.

I solved this by different approach. I uploaded the documents, in a temporary memory & persisted it later.

---

<div class="post-metadata">

**Author:** ![MarissaRogers](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/marissarogers/32/23444_2.png) [@MarissaRogers](https://forums.pega.com/u/MarissaRogers)\
**Post date:** [August 30, 2021, 1:36pm UTC](https://forums.pega.com/t/upload-attachment/1656/4 "2021-08-30T13:36:08Z")

</div>

Thank you for sharing your resolution and marking it as the solution in your Question, @Abhishek_Mondal!
