How to save Blobs in database?

How do I save file-like data into the Adalo database?

Blobs or buffers etc.

The formValue seems to only be able to save one of these types: manifest.json | Adalo text, number, boolean, icon, color, date, list, action

action may be the most promising, how do I use that to save a Blob in the database?

Since a database can have a File property, it seems likely Adalo supports exporting data from a component into that field of a database

Convert to base64.

Something like Buffer.from(content).toString(“base64”)
Should do it

1 Like

That’s unfortunately poor compression, I’d rather store the binary data directly, and it seems like it should be supported since the database even has a File column datatype

As you pointed out in the component maker manifest, makers don’t have the ability to upload files. You can use the S3 service from @theadaloguy (I think it is his) or build your own component to store files in your own S3 bucket (or other file system). Otherwise base64 is the only option available to us.

1 Like

Thank you for the information. Do you happen to know how the built-in file Picker component works?

Yes, when you choose a file it posts to the adalo database endpoint which saves it to an S3 bucket with a random unique id and shows a preview using base64 encoding. Then when you save the record it will save the unique IDof the file in the database as text for future retrieval.

1 Like

Why can’t a custom component do that?

It can technically, but building things outside of the developer docs is against the rules so accessing and posting file records is off-limits. But it is very possible if you know what you are doing as seen in the video in the post below

1 Like

Thank you. Where can I read the rules that are relevant to this part of Adalo? Do you know what action Adalo takes against developers that violate them?

I do not think there is any published guidelines, the only reason I know the limits is because I had a conversation with Adalo when I started releasing my components and my marketplace. The rules are that your component can only use what is in the API docs. There is no way to POST a file using the REST api, and even if you tried to use the REST api in your component you would expose your Bearer token client side. There is no documented way to access the file upload system that exists in Adalo. You also cannot wrap providers around the main app.

As far as I know there is no action Adalo has ever taken against any developer that violates this. I am sure if you built this just for your app, and not release it to the public it would be okay.

In the video in this thread, how did you get Signature Phone > Signature Image to appear as an option in that menu?

It might be using Actions | Adalo right? But in arguments how do you specify the type to be a file?

{
  ...
  "props": [
    {
      "name": "exampleAction",
      "displayName": "Example Action",
      "type": "action",
      "arguments": [
        {
          "type": "number",
          "displayName": "Argument 1"
        },
        {
          "type": "text",
          "displayName": "Argument 2"
        }
      ]
    }
  ]
}```

Seems like the folks at Adalo deleted my post with the video. Sad state of affairs, setting the record straight, turns out it was me… I don’t remember the component. I think I took an input type image then figured out what the table and column id’s were so that I could upload the file and update the database.

You cannot upload files to the database, I believe Adalo deleting the video from the forum is further confirmation that they do not want you uploading files.

You will need to wait until Adalo added files to the API.

The video still seems to be there? Every new beginning comes from some other beginnings end - #43 by TKOTC

Do files get uploaded to an S3 bucket instead of the database?

I was talking about this one

For the one in the video, it is saved as base64 in the adalo database text field.

Oh that’s a shame ._.

“upload the file and update the database”

Was the file uploaded to Adalo’s S3 instance or to your own?

And to “update the database”, with an input-type field, is it just text behind the scenes? Does it store the URL to the file?

My Collections API reference, even for Collections I have that have file types and image types, never show me what should go in the POST or PUT requests to save the Image or File.

In my original it was to the adalo database, but using code that I cannot publish.

You cannot POST or PUT files and images into the database from the API.

You need to reverse engineer how the file/image upload component works then use that to build your component. Reverse engineering is against the ToC of Adalo.