I do that server side - you can see my instructions for s3 + nodeJS here.
The salient line in the server code section is (note the “Account_Uploads/” - that’s the folder name - if the folder doesn’t exist in your s3 bucket, it will be created - I’m prepending a date stamp to the filename):
Key:`Account_Uploads/${Date.now().toString()}-${JSON.parse(Object.keys(req.body)[0]).filename}`, // what we'll call our file - here I'm using a folder called "Account_Uploads" to put all my uploads into, then prepending a date string to the filename to avoid collisions - S3 will overwrite a file if another with the same key (i.e. name) is uploaded! We have to again extract the filename in a tedious fashion...
Hope that’s helpful.
PS: I should add that I don’t use Companion, so YMMV…
What does your server side code look like? Because the S3 options section of the Companion documentation indicates you simply prepend the filename with the folder name (the same way I do in the example I gave) - they suggest you can use data from the “req” object, but you can use anything - “test/” in your case:
"The req parameter can be used to upload to a user-specific folder in your bucket, for example: