Thanks, Ty, I really appreciate your quick replies to my questions!
One of the reasons we need to preserve the filename is that we have a few PDF and Word documents that people need to download as part of a specialised workflow, and it is important that each file retains the original name. If the only things we were uploading were images for display, the renaming wouldn’t be an issue, and with images and certain other files I can certainly see the value in the timestamp, as you point out.
Looking at your code, though, raises one further little question: I’m not a PHP guy, so I’ve probably got it completely wrong, but the two lines you’ve highlighted make me think that the the timestamp should be added at the start of the filename. So “file.pdf” would become something like “1234567890-file.pdf”. If so, I must be doing something wrong, because the file that ends up on S3 is actually “1234567890-.pdf” (that is, just the timestamp plus a dash). All references to the original filename are being removed, though the correct name is still being returned by the {custom_field:name} tag, though.
A good compromise for us, in fact, might be an option to append the timestamp at the *end* of the filename, which would solve both issues. In other words, we would be happy enough if “file.pdf” became “file-1234567890.pdf”. That would keep the filename for the workflow, avoid the issue of the file being overwritten, and have the added bonus that the timestamp might also come in handy for tracking what version of a file people had been using (some of the files will be returned to us as part of the workflow).
Anyway, I might have a bit of a play to see what we can come up with ... hopefully without breaking the whole thing! ![]()
If you don’t mind taking feature requests, though, do you think there’s any chance that file naming conventions could be introduced as a field setting? If that was possible, and not too much extra work, I think it would certainly take care of our own particular issue, and maybe even avoid any other potential concerns that others might have in the future.
Whatever happens, though, thanks heaps for all your help with this!
