I have a CMS collection with 10 different file upload fields.
It’s being used as a board meeting page, where they can upload various documents for each meeting.
Is there anyway to make the button or any text, the name of the file?
Only other way I can think of, is to make a text field x10 for each file name, but that will be tedious on the client.
It would be much easier to just make the text correspond to what the filename is.
Webflow prepends an internal ID, but otherwise the filename you used at upload is preserved intact. Here are 2 CMS items where the button text is automatically set to the linked CMS file field.
To extract that name and set the button text, you need a piece of script, and you’ll also want to identify the specific elements you’re wanting it to act on.
I’ve applied a custom attribute to those buttons of display-filename=""
Here’s the code you need, in the /body custom code section.