lowcoder-org / lowcoder

🔥 🔥 🔥 The Open Source Retool, Tooljet and Appsmith Alternative
https://www.lowcoder.cloud/
GNU Affero General Public License v3.0
836 stars 175 forks source link

[Feat]: File Upload Can't get the Binary data or path #959

Closed hoahai closed 2 months ago

hoahai commented 3 months ago

Currently, the File Upload Components will automatically encode the file to base64. There are also no path to file. This makes it hard to upload the file to Cloud Storage.

How can we, as app Editor/Developer, get the file and upload it to other Cloud storage such as Dropbox?

martkaczmarek commented 3 months ago

What path do you mean? I don't think the file is saved anywhere at this point; it just resides in memory as some JS variable - just like with a valu from any input component. You can take this value and upload it via REST or other API straight to cloud (or some database, I guess). So I think storing it as base64 is perfectly fine choice - we don't need the binary representation of the file anywhere in the app.

hoahai commented 3 months ago

Some API such as Dropbox doesn't accept base64. Do you have any idea on how to upload the file to such server, especially via https REST API?

FalkWolsky commented 2 months ago

We do have the Restful API Query, where you can set the Body mode to form and then attach a file. Based on that and a (yes a bit cryptically) way to tell the backend (api-service) how to treat a file, you can achieve the sending of the file as binary content. However, in the app (browser) it will be still indeed a base64 encoded file.

You will need this (similar) formulation in combination with the file uploader component: {{ {data: file1.value[0], name: file1.files[0].name} }}

Screenshot 2024-07-21 at 18 00 01