Need help with: Add local drive as resource for self-hosting

Hi

I'm testing ReTool if this is the tool for us and we can use it for internal processes. note I'm new to coding.

I have a App "Task" and I want to add attachment / documents to the task I'm working on. The files shall be stored on our server and not in any clouds.

Is there a way to use drag and drop component and a button to trigger upload file to eg. D://task/files/[fileID]/filename.pdf

Is there a way to setup a disk as resource?

Any Ides in how to store files on our local server?

Hello @Thore!

You can upload files to a Retool app with several possible drag and drop components as shown in our docs here.

You can use a button to trigger a query (REST API or similar action)to interaction with a Resource(database) that you set up.

Currently we do not have any Resources for writing to your local Disk. You would have to send the data to a DB you host that is connected to a Retool App via a Resource and then process the data from there to your computer's disk.

Hi @Jack_T

To verify Base64.

If I store the Base64 in our DB. Can I use the PDF component to show the file later?

-Thore

@Thore Yes you can display a base64 encoded PDF with the in app component on Retool!

You can read more about the component here and here. You will need to change the PDF Source in the component's inspector tab.

The Storage option will allow you to chose the file from your disk and the JS option will take a File Object with key-values pairs as shown in the tool tip below.

Hi @Jack_T

I need some help with PDF component, can you help me get the Base64 to show in the PDF component?


image

As a user I want to select row in FileTable and the selected row / base64 will show in the pdf component. how can I do this?

-Thore

Hey @Thore,

From the error message it looks like you need to take the string you are trying to pass directly in, and first wrap it inside an object.

In the object the key will be 'base64Data' something like the error example {name: 'imageName, type: 'application/pdf, sizeBytes: number, base64Data: 'string'}. You can create this object in a transformer or Javascript Query and then send the result of that into the PDF display component.

Also for reference on using PDFs check out this very useful thread here!