APIs & Integrations

andreas_tinocol
Member

Form API File field

Hi,

currently I am trying to submit form data through your Form API. My form contains a file field and although I was able to send simple text data, I can´t find any examples how to submit the data of my file field when submitting the form.

best regards and thanks for your help.

0 Upvotes
3 Replies 3
Dadams
HubSpot Employee
HubSpot Employee

Form API File field

Hi @andreas.tinocolobo

File upload properties are text properties, and they’re designed to store the URL of a file that’s uploaded to some storage platform. The property itself cannot store an actual file, so if you’re using an upload property in a custom form, you’d need to upload the file separately, and then store a URL that could be used to access that file in the actual form field being sent to HubSpot.

0 Upvotes
andreas_tinocol
Member

Form API File field

Thanks for your reply, is there any way to get a public URL after uploading a file through the COS File API (http://developers.hubspot.com/docs/methods/files/post_files)

Iam aiming to add a custom file field to a form but would like to host the actual file also on hubspot and make it accessible somehow (embed into another website).

BR

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Form API File field

@andreas.tinocolobo when you upload a file to the file manager, the response will contain the JSON data for the new file (the same thing you’d get from this endpoint). That response will include a url, which is the URL of the file.

Keep in mind that files in the file manager would be accessible by anyone with the URL, so it should not be used for files with any type of sensitive information.

0 Upvotes