Uppload image to database

I’m going crazy soon. Have been sitting for a week now with the same problem. The only thing I want to do is the following:

  1. Pick an image from “Pick image from library”
  2. Save that image in the database.
  3. Pick out a url for the image, so I can send the url to restDB api, so they can download the image.

I do not need any other information about the image stored in the database, as I use the database only to get a url.

Someone?

You can’t save the url in the database as it’s valid only for a period of time. You need to save your storageKey and use that to regenerate download URL’s with [Get bucked download urls].

Note that you also have to get upload urls for the images to get the storageKey.

Yes, but I have read on the community pages over and over again. Have tried to understand how everything is connected but I do not understand this.
This storageKey and uploadUrl, is explained as if you have already understand and know this. Help me understand. A simple flow chart and which nodes are connected to each other would have been very helpful. Not just words like … use “upload files” for this :slight_smile: it does not propel me forward.

Sorry for not being too specific.

Here you have an image of the setup in composer

Here you have a description of what to input to each node.

Component tap:
    () => Pick image from library => file
    [outputs["Pick image from library"]] => Get bucket upload URLs  // note picked image cast to array
    outputs["Get bucket upload URLs"].files => Upload files // Upload files
    outputs["Get bucket upload URLs"].files[0].storageKey => Create record // persisting my storageKey 
    data.myStorageKey => Get bucket download URLs // get download url for a image component to show

Here you have an illustration of the process.


(Object storage == bucket)

Maybe this helps you understand whats going on.

1 Like

Now I actually saw that there’s was a regression on the flow function outputs documentation which failed to render properties of array of objects. So this most likely caused a lot of hassle trying to figure out what’s going on and what I’m talking about.

This is already fixed and shipping on the next release (this week I think).

Okay! Great, I’ll take a look at it again after this update.
Thanks for the help!

Hi there!

I followed all these steps to upload an image and have gotten a download URL successfully.

Problem is, once I open the download URL, it returns the page as shown in the image, indicating that access was denied.

Is there something else I should do not to have such access denied?

Thanks in advance.

I pass for same problem… Any solution?

I pass for same problem… Any solution? Please

I gave up, impossible to understand the documentation. I bought an Udemy course where they explain in detail how this works. Admittedly, he uploads files to Firebase, but the procedure is the same. However, I did not use Appgyver anymore, but switched to Wappler.
Link to the course if you are interested. Create an App with no code | Udemy

Is the object Storage a permanent storage? I tried to use this function to upload pdf or image and send it to another system to process via API. Where should I connect the file stored and the API?

The file upload flows have changed since this original thread was written – if you can, I recommend using Firebase to store files.

If you want to use a custom REST API, it needs to have a possibility for file uploads via a HTTPS method (usually POST). See https://docs.appgyver.com/data/file-uploads

hi Mevi,
Thank you for your response, however the HTTPS method is still not clear to me how can I connect it with a database e.g. Airtable. Is it only required to replace http://uploadurl with the actual database url in [ SET_KEY( outputs[“Pick files”].files[0], “uploadUrl”, “http://uploadurl”) ]?

Thank you

Yes, you need to put the correct upload url of your backend into the uploadUrl. Just the database is not enough - the path has to be one that files can be uploaded to.