[RELEASED / FREE] File Uploader Bubble API

Hi everyone!
Bubble have some limitations when getting a file and setting privacy on that file. For example, if you set “File” as the type in API Connector, this file is not private.
More than that, when using API Connector, in some case, the file doens’t have an extension or a correct filename.

This plugin was made for this kind of limitations. You continue to get the file like you did, you pass the file url to the plugin that will upload a new version, renamed if needed and with full privacy settings (including attach to…)

This tool use the Bubble file Uploader API to take a file from url and send it to Bubble file storage. You can use this to:

  • Rename a file
  • Set privacy on file

This is just one Server side action

Use the action File Upload
In “Base Website Url” field, you should use Website Home url. Note that files upload are version related.

Complete all others field according to your need. Don’t forget to set the file extension in filename field.

After the action, the plugin will return the new uploaded file.
Don’t forget to delete original file if needed.

If you have any question, I’m here to answer :wink:

10 Likes

Hey @Jici !
I was trying to use this plugin to upload a file from an url to bubble storage, but for some reason it isn’t doing it appropriately.

For eg: I have a pdf created and its on https://us1.pdfgeneratorapi.com/. I want this pdf to be uploaded to bubble’s file store and save the new url in the db.

Below is how I have it setup:


Note: the Dynamic Link is pointing to the actual doc link https://us1.pdfgeneratorapi.com/share/xxxxx/xxxxxxxxx.

I am saving the new URL like so:
image

Upon executing the workflow what actually gets saved in the db is some html content.

https://bubble.io/<!DOCTYPE%20html><!--[if%20IE%208]><html%20class="ie8"%20xmlns="http://www.w3.org/1999/xhtml"%20xmlns:ipp="">%20<![endif]--><!--[if%20IE%209]><html%20class="ie9%20gt-ie8">%20<![endif]--><!--[if%20gt%20IE%209]><!--><html%20class="gt-ie8%20gt-ie9%20not-ie">%20<!--<![endif]--><head>%20%20%20%20<meta%20charset="utf-8">%20%20%20%20<meta%20http-equiv="X-UA-Compatible"%20content="IE=edge,chrome=1">%20%20%20%20<link%20rel="stylesheet"%20type="text/css"%20href="https://us1.pdfgeneratorapi.com/assets/deploy/app_public/css/dd72a905a1bbccb24e93e40b73c51880.css"%20/><title>PDF%20Generator%20API%20Automate%20PDF%20document%20creation</title>%20%20%20%20<meta%20name="viewport"%20content="width=device-width,%20initial-scale=1.0,%20user-scalable=no,%20minimum-scale=1.0,%20maximum-scale=1.0">%20%20%20%20<meta%20name="apple-mobile-web-app-capable"%20content="yes">%20%20%20%20<meta%20name="apple-mobile-web-app-status-bar-style"%20content="black">%20%20%20%20<!--%20Open%20Sans%20font%20from%20Google%20CDN%20-->%20%20%20%20<link%20rel="apple-touch-icon"%20href="/assets/deploy/app_public/images/apple-touch-icon.png">%20%20%20%20%20%20<!--%20Global%20site%20tag%20(gtag.js)%20-%20Google%20Analytics%20-->%20%20<script%20async%20src="https://www.googletagmanager.com/gtag/js?id=UA-35082122-11"></script>%20%20<script>%20%20%20%20window.dataLayer%20=%20window.dataLayer%20||%20[];%20%20%20%20function%20gtag(){dataLayer.push(arguments);}%20%20%20%20gtag('js',%20new%20Date());%20%20%20%20gtag(%27config%27,%20%27UA-35082122-11%27);%20%20%20%20%20%20%3C/script%3E%20%20%20%20%3Cscript%20src=%22https://www.google.com/recaptcha/api.js%22%20async%20defer%3E%3C/script%3E%3C/head%3E%3Cbody%20class=%22public-layout%20theme-default%20page-404%22%3E%3Cscript%20type=%22text/javascript%22%3E/%3C![CDATA[/var%20YII_CSRF_TOKEN%20=%20%22bmVHeExabzFXZ2FFUlVGTkFzWjFmajZOblNHNFRLZFEbT3ondRkU_87bqPTpxYQ3obDVMwgk-aI_AfY4j6oncQ==%22;/]]%3E/%3C/script%3E%20%20%3Cdiv%20class=%22error-code%22%3E404%3C/div%3E%3Cdiv%20class=%22error-text%22%3E%20%20%20%20%3Cspan%20class=%22oops%22%3EOOPS!%3C/span%3E%3Cbr%3E%20%20%20%20%3Cspan%20class=%22hr%22%3E%3C/span%3E%20%20%20%20%3Cbr%3E%20%20%20%20SOMETHING%20WENT%20WRONG,%20OR%20THAT%20PAGE%20DOESN%27T%20EXIST…%20YET%20%20%20%20%3Cbr/%3E%20%20%20%20%3Cspan%20class=%22hr%22%3E%3C/span%3E%20%20%20%20%3Cbr/%3E%20%20%20%20%3Ca%20href=%22/logout%22%20style=%22font-weight:%20300;%22%3ELogin%3C/a%3E%20|%20%20%20%20%3Ca%20href=%22/signup%22%20style=%22font-weight:%20300;%22%3ECreate%20a%20account%3C/a%3E%20|%20%20%20%20%3Ca%20href=%22/%22%20style=%22font-weight:%20300;%22%3EHome%3C/a%3E%20|%3C/div%3E%3Cscript%20type=%22text/javascript%22%20src=%22https://us1.pdfgeneratorapi.com/assets/deploy/app_public/js/dd72a905a1bbccb24e93e40b73c51880.js%22%3E%3C/script%3E%3C/body%3E%3C/html%3E

Can you help me fix this please?

Thank you!

Base webhsite url should be your app url, not a custom url.
The dynamic link should be the file url you want to upload to Bubble File API. The base url is just to know your app url to use the Bubble file API.
Actually, I don’t think you are using this correctly.

You probably already call the pdfgenerator API in step 1? Does it return a file or a url?

It returns an URL and the file name. I am not using their API, but their plugin.

The PDF generator plugin returns the url of the file without an issue. I am good using that, but they would store the file for 30 days max before deleting it. Hence, trying to figure out a way to push it to bubble storage so that it hangs around there for longer.

Appreciate the help @Jici .

Th easiest way to save it in bubble is just to add :saved to s3 if this return a url. This step should also let you rename the file. The plugin is more to use when the API return directly a file, in this case, Bubble save it automatically into Bubble storage, but you have no power on the name. Another use case is (and could apply to you) if you want to set privacy rules on the file (:saved to s3 doesn’t have option to make this file private)

Be sure, in API connector, to have set the file parameters as a “file” type… not text (that is default)

Surprisingly I do not see the :saved to s3 option. Which is why the workaround.
Btw the pdf gen plugin also returns the base64 encoded string, could that be of used?

If you don’t see it, this is because you didn’t set the url field in API Connector to be type of file.
Please share your initialized API Connector settings

Got around to try it now and this worked!

1 Like

Thank you for the help @Jici !

1 Like

Hi, @Jici. Your plugin sounds great, but I’m having trouble getting it to fully work. Can you help?

I confirmed I’m using the plugin’s current version (“1.1.0 - Updated to node 18”). I also tried downgrading to the immediate prior version (“1.0.0 - Public release”), but still wasn’t successful.

The “File Upload” action uploads the file as expected, including renaming and attaching for privacy. However, I can’t reference the File Upload action’s outputs in order to save a reference to the new file in a field.

I confirmed there are no privacy rules precluding reference to fields or attached files in the data type where the file is attached.

Here’s my workflow. It runs when a file is created by the 1T - CSV Creator plugin’s “CSV Creator” event.


Here’s confirmation via the debugger of all the inputs:

However, in the very next workflow action, there’s no file from the previous step to reference. The results of the File Upload action are empty:

In the File Manager, I see the file–as expected, renamed and attached for privacy:

Hi There !

I’m using like This… BACKEND WORKFLOW

Get this results…
No USER… Why?


Tks in advance !

How do you trigger your backend wf?

I did sent User from front end, but it is useless.
So… to be clear… Current User is sent from front end.
Have you got different results?

Is current user logged in?
I’m not the owner anymore. So I cannot test.

Is logged in Jici !
I’ve contacted current author, he says it is normal behavior…
Sounds strange although…

Do you have privacy rules on user DB?

Yep ! Does it changes anything? Cause it do register…

Try without privacy rules to see if this is assigned to user

It looks like this issue has been fixed in the plugin’s new version, 1.2.0. Thanks a lot, @Thimo !!

1 Like