Upload PDF via Bubble API


I am trying to upload a PDF (base64) file to bubble via API, I have tried the following:

1 TRY - upload via API in base64 format in a TEXT field in the database, it works well however I cant seem to make it work to download the file when using my phone! I have tried to use the following html, it works well on my computer but it doesnt work on my phone:

<a href="data:application/pdf;base64,BASE64_PDF_FILE" download="file.pdf">Download</a>

2 - upload via API in base64 format in a FILE field, the upload process succeed however when I try to get the file from amazon, I get the following error:


here is the link of the file:

****I dont think my problem is the API request, I am pretty confident about that, it is just the format or another thing I am missing on the upload.

@Jici Any thoughts on this? Interested in your opinion :+1:t2:

I think that the first thing to try would be to use :saved to s3 instead of base 64.
Error seem to say it’s forbidden. Do the file have private setting?

Maybe you can share screenshot of your setting from API connector to WF you are using?

1 Like

Hi @traksit.adm ,

yes, possible by using of javascript.

Demo URL : https://testnew111.bubbleapps.io/version-test/downloadpdf

This page have all the necessary details for execute this function.

1 Like

I created a plugin that does this. Hopefully what you’re trying to do gets a little easier with it:

I spent a couple of frustrating days on a similar issue and after pulling most of my hair out I managed to set this up! It does URL->Base64 and Base64->Bubble S3 URL

1 Like

Hey @blurapps

Looking good but how do you attach the uploaded file to a database record?

I mean if I have a base64 pdf, how can I upload to a database record the “.pdf” file?

To add it to your DB, you can use the ‘Base64 Upload to Bubble’ action. This will add the file to Bubble’s internal S3 bucket linked to your app and give you a URL to it.

Then you can do a ‘make changes to a thing’ or ‘create a thing’ action with this URL in the image or file field of the thing.

I´ve tried that but it does not get the file in a type file uploaded.

Hi Ryan

I see your point. Just added an event trigger for when the URL is successfully generated - this part is internally async.
So if you run your DB modification actions in the WF triggered by this new event ‘URL is Generated’ it will work.

Check out the demo here:

Try it on the Editor: Blur-apps-playground | Bubble Editor

1 Like

Hey @blurapps

Now it works.

Thanks a lot for that.

1 Like

Hey @blurapps

Does it work in the backend?

Thanks a lot.

1 Like