# Save Base64 encoded file to Bubble

**URL:** <https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142>\
**Category:** Questions\
**Created:** [August 12, 2019, 10:46am UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142 "2019-08-12T10:46:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesdevonport](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jamesdevonport/32/226111_2.png) [@jamesdevonport](https://forum.bubble.io/u/jamesdevonport)\
**Post date:** [August 12, 2019, 10:46am UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/1 "2019-08-12T10:46:43Z")

</div>

Hey everyone,

I have an API Workflow that returns a Base64 encoded audio file which I want to save to Bubble.

I can’t seem to find a way of decrypting the base64 down to a MP3 and saving it as part of a workflow, there are a few plugins but seem to be client side only.

Bubble seems to support encrypting to Base64 nativly but I’m a bit stuck for decrypting… if anyone has an idea of a solution would be great!

Thanks, James.

---

<div class="post-metadata">

**Author:** ![jamesdevonport](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jamesdevonport/32/226111_2.png) [@jamesdevonport](https://forum.bubble.io/u/jamesdevonport)\
**Post date:** [August 13, 2019, 4:15pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/2 "2019-08-13T16:15:23Z")

</div>

I’m attempting to write a new plugin to do this, I’ll release it back to the community if I can get it working.

I’m currently trying to get the following working as a server side action to decrypt the base64 string and return a file but it’s not working.

Does anyone have any suggestions what I might be doing wrong? 🙂

```
function(properties, context) {
    return { 
        output: Buffer.from(properties.inputText.replace('data:audio/mp3; codecs=opus;base64,', ''), 'base64') 
    };
}
```

---

<div class="post-metadata">

**Author:** ![JohnMark](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/johnmark/32/42431_2.png) [@JohnMark](https://forum.bubble.io/u/JohnMark)\
**Post date:** [August 13, 2019, 4:54pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/3 "2019-08-13T16:54:36Z")

</div>

Hi @jamesdevonport,

I think that @lottemint.md Sergey can give you an help on that, as I will need it in the future also. In my case “application Octet/Stream” for a wav file didn’t work too.

---

<div class="post-metadata">

**Author:** ![lottemint.md](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/lottemint.md/32/26549_2.png) [@lottemint.md](https://forum.bubble.io/u/lottemint.md)\
**Post date:** [August 13, 2019, 5:02pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/4 "2019-08-13T17:02:22Z")

</div>

Hello @jamesdevonport,  
As I understood, you are trying to save a file.

Take a look at the following link, please:

> **[Introduction](https://manual.bubble.io/)**
>
> Welcome to the Bubble Docs.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/1/7/17e2dd71c3b517420e7ad504d00fe3b1945667fc.png)

You need to send that content to an API workflow that is waiting for a file:  
 ![image](https://us1.discourse-cdn.com/bubble/original/3X/3/d/3d762da3b39013cbaf59b19e335845d8f4104dde.png)

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/b/7/b7c836ee57bda5f68c7305eb82d6f3aa9584ba60.png)

---

<div class="post-metadata">

**Author:** ![jamesdevonport](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jamesdevonport/32/226111_2.png) [@jamesdevonport](https://forum.bubble.io/u/jamesdevonport)\
**Post date:** [August 13, 2019, 6:04pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/5 "2019-08-13T18:04:26Z")

</div>

@JohnMark @lottemint.md Thanks both for the help on this, looks promising! I’ll have another go based on this and let you know how I get on 👍

---

<div class="post-metadata">

**Author:** ![jamesdevonport](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jamesdevonport/32/226111_2.png) [@jamesdevonport](https://forum.bubble.io/u/jamesdevonport)\
**Post date:** [August 13, 2019, 6:21pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/6 "2019-08-13T18:21:10Z")

</div>

@JohnMark @lottemint.md Thanks so much, followed these steps and it works perfectly! No need for a plugin now I can do it all through API Workflows 😃

---

<div class="post-metadata">

**Author:** ![contato11](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/contato11/32/139783_2.png) [@contato11](https://forum.bubble.io/u/contato11)\
**Post date:** [January 2, 2021, 8:49pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/7 "2021-01-02T20:49:34Z")

</div>

Hi  
It could explain how to set up the entire flow in Bubble.

I have a similar problem. I’m trying to get email attachments via the gmail API.

I cannot convert and save attachments received as a base64 string.

I tried to follow the previous information, but I couldn’t get it to work.

Thanks

---

<div class="post-metadata">

**Author:** ![jaredg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jaredg/32/60995_2.png) [@jaredg](https://forum.bubble.io/u/jaredg)\
**Post date:** [January 23, 2021, 9:13pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/8 "2021-01-23T21:13:14Z")

</div>

I cannot seem to replicate this functionality. I have an API returning a base64 image. I can’t seem to get Bubble to accept it. Does anyone have any more in-depth instructions on how to use an API workflow to accomplish this?

---

<div class="post-metadata">

**Author:** ![jaredg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jaredg/32/60995_2.png) [@jaredg](https://forum.bubble.io/u/jaredg)\
**Post date:** [January 23, 2021, 9:27pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/9 "2021-01-23T21:27:37Z")

</div>

@jamesdevonport @JohnMark @lottemint.md

Any ideas what I’m doing wrong here?

 ![Screen Shot 2021-01-23 at 3.24.06 PM](https://us1.discourse-cdn.com/bubble/original/3X/4/f/4fbcdcd532cf6d4b6e8792dcfdc3cbe8c9f6fe7e.png)

 ![Screen Shot 2021-01-23 at 3.24.33 PM](https://us1.discourse-cdn.com/bubble/original/3X/3/5/35db8471cf154a553894d43df1cd7ad7a4fabec1.png)

Called by API Connector:

 ![Screen Shot 2021-01-23 at 3.22.40 PM](https://us1.discourse-cdn.com/bubble/original/3X/3/7/37af29a6ca28338f3a0d0462a54689732ff7e340.png)

Initialize gives this error:

 ![Screen Shot 2021-01-23 at 3.22.22 PM](https://us1.discourse-cdn.com/bubble/original/3X/2/d/2d4cdff912d2023a3adda05106decdd9a61dda6a.png)

---

<div class="post-metadata">

**Author:** ![gaimed](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/gaimed/32/184165_2.png) [@gaimed](https://forum.bubble.io/u/gaimed)\
**Post date:** [January 23, 2021, 9:53pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/10 "2021-01-23T21:53:41Z")

</div>

Look at my plugin [https://bubble.io/plugin/screenshot-generator-1610471760948x573297415344619500](https://bubble.io/plugin/screenshot-generator-1610471760948x573297415344619500) and then the api menu. It makes uploading very easy using base64

---

<div class="post-metadata">

**Author:** ![jaredg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jaredg/32/60995_2.png) [@jaredg](https://forum.bubble.io/u/jaredg)\
**Post date:** [January 24, 2021, 1:18am UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/11 "2021-01-24T01:18:55Z")

</div>

Thanks! Question about the endpoint you are calling: [WebsiteHomeUrl]fileupload  
Is that built in or is that an API backend workflow you’ve created?

When I try this, I get this error upon initialization:

"There was an issue setting up your call.

Raw response for the API  
Status code 400  
{“statusCode”:400,“body”:{“status”:“INVALID\_DATA”,“message”:“Invalid data for key contents: not a valid url or object”}}

I must have the API endpoint configured incorrectly… The “content” key is set as “image” currently.

---

<div class="post-metadata">

**Author:** ![jaredg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jaredg/32/60995_2.png) [@jaredg](https://forum.bubble.io/u/jaredg)\
**Post date:** [January 24, 2021, 2:22am UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/12 "2021-01-24T02:22:07Z")

</div>

Ok, wow. Instead of my own API endpoint, I tried it out at the website\_home\_url/fileupload and hello built-in undocumented feature!

Thanks for pointing it out!

---

<div class="post-metadata">

**Author:** ![lottemint.md](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/lottemint.md/32/26549_2.png) [@lottemint.md](https://forum.bubble.io/u/lottemint.md)\
**Post date:** [January 25, 2021, 11:02pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/13 "2021-01-25T23:02:29Z")

</div>

If you add private & attach\_to parameters, you can upload private files.

---

<div class="post-metadata">

**Author:** ![PineappleJoe](https://avatars.discourse-cdn.com/v4/letter/p/b4bc9f/32.png) [@PineappleJoe](https://forum.bubble.io/u/PineappleJoe)\
**Post date:** [July 8, 2021, 5:55pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/14 "2021-07-08T17:55:53Z")

</div>

Hey @jaredg - can you explain how to make the call?  
Im trying to do the same thing but not super familiar with API endpoints.

---

<div class="post-metadata">

**Author:** ![localprosnet](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/localprosnet/32/221635_2.png) [@localprosnet](https://forum.bubble.io/u/localprosnet)\
**Post date:** [October 21, 2021, 4:13pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/15 "2021-10-21T16:13:39Z")

</div>

@jaredg can you explain how you got it working? I’m not following this thread easily. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![jaredg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jaredg/32/60995_2.png) [@jaredg](https://forum.bubble.io/u/jaredg)\
**Post date:** [October 24, 2021, 6:47pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/16 "2021-10-24T18:47:44Z")

</div>

Use the API Connector plugin and connect to your own app URL. There’s a built in endpoint at [YOUR APP URL]/fileupload  
Here’s what I did:

 ![Screen Shot 2021-10-24 at 1.44.10 PM](https://us1.discourse-cdn.com/bubble/original/3X/4/5/45d3bfe07dfd1d7ca2ef9de6f7329c718fb9de5d.png)

---

<div class="post-metadata">

**Author:** ![eddy](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/eddy/32/89468_2.png) [@eddy](https://forum.bubble.io/u/eddy)\
**Post date:** [February 28, 2022, 1:29pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/17 "2022-02-28T13:29:45Z")

</div>

Wauw thanks this is a perfect solution! 😃

---

<div class="post-metadata">

**Author:** ![seuguh38](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@seuguh38](https://forum.bubble.io/u/seuguh38)\
**Post date:** [January 30, 2023, 8:32pm UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/18 "2023-01-30T20:32:33Z")

</div>

So smart. I really need to upload Base64 files and you saved my day.  
many thanks @jaredg

---

<div class="post-metadata">

**Author:** ![se.belobrov](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/se.belobrov/32/72196_2.png) [@se.belobrov](https://forum.bubble.io/u/se.belobrov)\
**Post date:** [April 25, 2023, 8:06am UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/19 "2023-04-25T08:06:52Z")

</div>

> [@jaredg](#):
>
> I must have the API endpoint configured incorrectly… The “content” key is set as “image” currently.

Hi Jaredg,

I spent several days trying to solve this problem. And I still can’t find a solution for it.

It looks like you got what I need. I understood how you are sending the file. Can you please show a screenshot of what your final endpoint (to which you send this file) is doing?

---

<div class="post-metadata">

**Author:** ![kiptanui](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/kiptanui/32/181681_2.png) [@kiptanui](https://forum.bubble.io/u/kiptanui)\
**Post date:** [June 1, 2023, 11:35am UTC](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142/20 "2023-06-01T11:35:51Z")

</div>

If the content type is set as “buffer,” will this still work?

[Next page](https://forum.bubble.io/t/save-base64-encoded-file-to-bubble/64142.md?page=2)
