How to return File type data in element in Bubble plugin?

How to return File type data in element in Bubble plugin?

While making the "File-uploader" or any file-related plugin, you realize it's better to use the "File" data type instead of showing the "file-url" as text. Using the "File" data type instead of "file-url" has many advantages. For example, you can put the "File-name" and "File-url" in the same variable instead of making two separate variables. You can also directly save the "File" type data into Bubble DB.

But the real question is how to do it -

Follow these steps-

Step 1:

Create the variable type "File" as the exposed state-

Step 2:

Create a variable to hold the file URL (remember to add the "https" prefix if it's not already included) and then expose the variable.

var file_url = "https"+url_without_http; 
instance.publishState("uploaded_file",file_url);

It will automatically expose the file-name too.


That's all for this blog. Subscribe for more future updates. Thank you!

Follow me on twitter.

Checkout My Bubble Plugin Course - Use coupon code "THEBUBBLEGROUP" at checkout for 10% discount.