Hi, I’m having a problem with changing filenames I’d love to get help with.
TL;DR
There is no point at which I can set the file name when files are not from an external API. Is there a workaround?
Long version:
The situation is as follows:
-
Users go through a dynamic questionnaire with multiple points where they can upload files. However all their process is is one page (index) and all the files are essentially uploaded with the same uploader (an element of Bubble’s multi-file uploader). Triggering the uploader may be done is several ways though, and usually the user isn’t clicking on it directly but rather clicks an image that triggers a javascript code which triggers the uploader, and it all works flawlessly for the past year.
-
When the uploader’s value is changed it calls for a backend API workflow that process the files one by one.
In the backend, for every file it creates an “upload” thing with the relevant details and permissions.
- Later, an employee of my company downloads relevant files from the page “report”. The files are downloaded together as a zip file using a plugin. There is no option to indicate the filenames of the files inside the zip file.
We have two issues with the files:
a) Multiple files may have the same name and therefore only one of them is saved. I would like to preserve the original name the user gave the file and I do need all the files. I am fine with adding a suffix to the filename to be able to save them all and I think adding a 4-8 random characters or incrementing a number will help. To have a proper random suffix I think that a hash of the current number of files together with the timestamp will avoid collisions.
b) Filenames are saved apparently with URL encoding and are unreadable, especially since most of them are in Hebrew, so I would want to format it correctly. I think this is possible with a text modifier in bubble.
So, I have come up with solution to how to format the filenames, but I have no point in the workflows where I can indicate these names: not when saving the files with the uploader, and not when downloading as a zip file with the other plugin. Therefore I think that (without disrupting the website and changing these core components) I would have to change the filenames in s3 after they are saved. I couldn’t find a native bubble way to accomplish that.
Maybe it is possible rewriting and deleting the file? maybe treating it as an external API somehow and ‘saving to S3’? Would something like this work? How would I set this up?
Please advise me of how to accomplish that and solve my two issues with the filenames.
Thank you for your ideas!