How to attach file to thing if thing doesn't exist already?

I am working on a form where we need to input a file and then attach the file privately to the form submission.

The setting requires attaching the file to a thing, but that thing doesn’t exist yet because the form is not yet submitted.

I don’t understand what the expected setup is in this case.

Can you help me understand? Thanks.

Regards

You can create a thing first in your DB and then attach the file to this newly created thing in the subsequent step

Yeah I have another app where creating the thing first is applicable. In this case though we don’t want to create anything in the database first, besides the file upload is a feature that’s added to an existing project and creating the thing first would probably cause a lot of work to be re-done.

Is there just action to set the privacy of a file within workflows? It feels uncessarily constraining to have to create the database object first.

Edit: moreover our database thing creation is happening via an API at the backend.

Yeah, found another method but not sure if you’ll find it useful

Maybe you can create a “state” with “file” type and upload the file to that state. Then when you create the thing you can take the file from the custom state.

Right, but then when you create the thing, how do you set the privacy on the file?

1 Like

It seems there is a File Upload plugin that can do that. I’m going to test it.

OK so the solution is to use the File Uploader plugin: File Uploader Bubble API Plugin | Bubble

  1. Upload the file on the file uploader without privacy.
  2. Send the file into (backend) workflow.
  3. Create the new database thing.
  4. Upload a new file to the file server using the File Uploader plugin, set the file to private and attach to the thing created in step 3.
  5. Delete the file uploaded in step 1 (or passed into the backend workflow in step 2), using Bubble’s native “delete an uploaded file” action.

Not sure who to tag @Bubble to address this question but: why do we need to rely on a third party plugin for this action? It seems like a core activity and should already be available as native action, no?

This topic was automatically closed after 70 days. New replies are no longer allowed.