S3 Upload - how can I include data so I can store it in the database?

I’m using the S3 upload for members to upload files. The specific step I’m using is ‘Sign Upload Url’ and it’s working well.

However, I want to record that the file has been uploaded in my database so want to send the record ID to the SC API which handles the upload. I’ve search and can’t find the answer to this.

Can you tell me how I do it? Many thanks.

just add a database insert step in your server connect and add the filename there.

Thanks @baub. It’s not just the filename I want to store. I also want the ID of the record the upload is linked to so I need to pass that ID to the SC Action script.

Can anyone help with how to send data to the SC when uploading to S3?

Are you signing the URLs because you are uploading client side?

I upload server side and add the key to the db so that I can delete or update the file later and keep track of who uploaded what.

I only want visitors to upload and not have the ability to update or delete or even view what’s been uploaded so I’ve used the S3 Upload Control and then created an SC Action Script containing the Sign Upload Url action.

Is there a better way of doing this? Which action should I use if I do it server-side? I don’t mind which method I use, I just need to upload the file, determine where it’s stored and what it’s called and also insert a record in my database to store the details.

You coulod just upload the file via form to the server:

Next upload it to s3:

Delete it from the server:

And store the key in the db:

1 Like

Thanks @tbvgl. That’s exactly the process I’m now doing. But it was good uploading directly to S3 so a little frustrating I can’t pass any other data at the same time.

Maybe output the ‘Put File’ step, then have a repeat that takes the output and within the repeat have a create or insert to database step for the file names and paths?

We had to update the Wappler file upload extension to be able to get the file data and some other things.
I never got around to creating a FR for this.

I’ve now switched to using the SC Put File action which is actually a better workflow. The file is uploaded to the server, then sent to the S3 bucket using Put File, then deleted from the server. This is working fine so I’m very happy with this solution.

I’m waiting to hear back from the team about the need for GetObject permission to be in the policy when sending the file as that is a security risk for me. I specifically only want the API key to have write only access but this gives an error and prevents the action from completing despite the file successfully uploading to the bucket.