Hi, I’m trying to save pdf files to S3, from an external URL. The problem is, the file has always the same name, and when trying o save to S3 Bubble replaces other file that’s already there.
Is there a way to rename the file before saving do S3, or saving the same filename but in different path?
I don’t know the best approach for this situation, all I need is to save various files that are available with the same name.
For example, I’m trying to save this URL https://docs.google.com/spreadsheets/d/1rmY0ujoGhpfyWLp-WTGpY0GFEmG61y3y5wpaF14c4UQ/export?format=pdf to S3, its name is always the same, but content is not, and Bubble just replaces it every time instead of duplicating.
This is definitely doable. How are you fetching/saving the file? Some common options are:
- prefix the name of the file with a date or datetime, or a random string, or a user email, etc
- prefix the file name with a pseudo-directory (e.g., user1/filename.pdf). The value before the slash isn’t actually a directory, as in Linux/*nix filesystems, but you can sort of use them in that way.
- turn on bucket versioning, so you’ll store each new copy of the file, but all with the same name, just as different versions. You can’t easily work with the different versions, afterward though.
I’d recommend the first option, but if you provide some more context, there may be other solutions that come to mind.
Cheers
Thanks @launchable for the quick reply. Those options make sense, but I just couldn’t figure out how I can edit the file name. My workflow is like below, it gets that external URL from the DB and save to S3.
Could you give me an exemple on how to insert any prefix to the file name?
Can you show a few more of the workflow actions around that? I’m not quite sure what’s going on from just that screenshot. Most importantly, how are you uploading the PDFs? Are you using the default file uploader?
Actually, that url that I mentioned at the initial topic is the file itself, directly exported from a spreadsheet, I’m not using file uploader or similar. I just saved that url to the DB as a file, it works, but I need to copy that to S3 with different name each time, because I can’t changed the name in the spreadsheet programmatically.
Solved like this How to clone a file uploaded to Bubble S3 - #9 by james.puddicombe