# FileUpload Example Postman

**URL:** <https://community.hubspot.com/t/fileupload-example-postman/118416>\
**Category:** APIs & Integrations\
**Tags:** starter\
**Created:** [October 15, 2024, 1:52pm UTC](https://community.hubspot.com/t/fileupload-example-postman/118416 "2024-10-15T13:52:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![OliSteini](https://avatars.discourse-cdn.com/v4/letter/o/bb73d2/32.png) [@OliSteini](https://community.hubspot.com/u/OliSteini)\
**Post date:** [October 15, 2024, 1:52pm UTC](https://community.hubspot.com/t/fileupload-example-postman/118416/1 "2024-10-15T13:52:46Z")

</div>

Hello,

can anyone please provide a working example for a file upload. Trying few things but ending at the moment with error:

![OliSteini_0-1729000307277.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/c/c60d1ee349f82e91f98bff967b690bd0239a60de.png)

---

<div class="post-metadata">

**Author:** ![SteveHTM](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stevehtm/32/22074_2.png) [@SteveHTM](https://community.hubspot.com/u/SteveHTM)\
**Post date:** [October 15, 2024, 3:04pm UTC](https://community.hubspot.com/t/fileupload-example-postman/118416/2 "2024-10-15T15:04:51Z")

</div>

@OliSteini - I’ve worked with this a number of time and I agree the documentation and examples are a bit underwhelming.

My approch has ended up being around getting the file data into an array format and then using that as the file parameter to the HubSpot API call. This is sensetive to the encoding used and it also seems necessary to be very careful constructing the header for the request.

```lia-code-sample
 # try this as a string input to files API call
 upload_url = "https://api.hubapi.com/filemanager/api/v3/files/upload"
 folder_name ="/test"
 file_options = {
 'ttl' : None,
 'access': 'PUBLIC_NOT_INDEXABLE',
 'overwrite': True,
 'duplicateValidationStrategy': 'NONE',
 'duplicateValidationScope': 'EXACT_FOLDER'
 }
 files_data = {
 'fileName' : file_name,
 'folderPath' : folder_name,
 'file': file_string,
 'options': json.dumps(file_options)
 }
 file_headers = {
 'Authorization': 'Bearer ' + appToken
 }

 #note special request headers required for file API payload encoding
 response = requests.post(upload_url, files=files_data, headers=file_headers)
 print("Doc upload response: ", response.status_code)

```

I hope this is helpful.

Steve

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [October 25, 2024, 1:28pm UTC](https://community.hubspot.com/t/fileupload-example-postman/118416/3 "2024-10-25T13:28:12Z")

</div>

try again hopefully it will soved.
