Typical process for saving files to S3 bucket through a form

Hi folks, I'm new to retool, coming from ~2 years working in Power Apps. Loving it so far but have managed to hit my first roadblock and was looking for some input.

I have built a simple app for tracking employee training. I have added a form to the app which collects all the relevant data to then be recorded to a new training record into my retool database.

One of the fields in my form is a file dropzone for the user to upload the training certificate. In my database, I have created a column to store the URL of the uploaded file.

This is where I am getting stuck.

I'm trying to figure out what the accepted "process" is for dealing with files in forms. I am aware that each account is given 5 GB of retool storage, but decided I would setup my own S3 bucket to future-proof the app as I would expect to hit this limit in the next year.

I have setup the S3 bucket (my first time using one), and have been thinking over what is the best way to do this is.

The general idea in my head is:

  1. User fills out the fields in the form and adds the certificate (typically a pdf)
  2. User hits submit
  3. Submit button triggers an upload of the certificate to the S3 bucket
  4. In the 'on success' of the S3 upload, somehow get the URL of the uploaded file
  5. In the 'on success' of getting the URL of the uploaded file, add the form data to the retool database, along with the URL

Am I on the right track?

Hey there @sct and welcome to the forum!

Yes, you're in the right track and the logic is sound. The only thing that I would add is that you can fetch the URL of the uploaded file by doing something similar to what shown in this post

Good luck and do write if you have any other questions!

2 Likes

Hi Miguel,

Thanks for your reply and I appreciate the confirmation I'm going about this the right way. Cheers for the link to that post. That was likely to be my next stumbling block so you've solved 2 issues for me today!

2 Likes