Pull data into s3 upload control eg. user_id

Hello all,

I am building the admin part of my website where a website admin would login and upload files to various user accounts.

I’m using the s3 upload control on the front end and then a server action that utilises the sign upload URL so that the file uploads to my digital ocean s3.

The problem I am having is getting data associated with the user to add to their relevant database row - it seems that the only data a server action with sign upload URL is the file name using a GET variable.

I am giving each uploaded file a custom name that is setup in my server action so I somehow need that custom name to be added to the relevant database row for the relevant user but I can’t seem to pull the user_id into my server action.

Here is my front end section with the upload control:


<div id="s3upload1" is="dmx-s3-upload" url="/api/admin/reports/upload_report" accept=".pdf" class="text-center border">
                    <p dmx-show="!file">Select file</p>
                    <p dmx-show="file">{{file.name}}</p>
                    <p dmx-hide="state.uploading">
                        <button class="btn btn-primary" dmx-on:click.stop="s3upload1.select()" dmx-show="state.idle">Browse</button>
                        <button class="btn btn-primary" dmx-on:click.stop="s3upload1.upload()" dmx-show="state.ready">Upload</button>
                        <button class="btn btn-danger" dmx-on:click.stop="s3upload1.reset()" dmx-show="state.done">Reset</button>
                    </p>
                    <p dmx-show="state.uploading">
                        Uploading {{uploadProgress.percent}}%
                        <button class="btn btn-danger" dmx-on:click.stop="s3upload1.abort()">Abort</button>
                    </p>
                </div>

And here is an image of my server action that signs the upload URL:

Many thanks in advance for your help - it really is appreciated.

Kind regards,

Leo