Rename uploaded file with form values at time of form submission?

Silverstripe Version: 3.7.3

Question:

Is it possible to not only rename a user submitted file using a file upload field, but also add other form data onto the file name for example a name or town?

I have been trying to extend userforms to allow for this but nothing appears to work. I tried this example but it keeps breaking the website when I try a dev/build.

Does anyone have any ideas how I could achieve this? Cheers

What error message are you getting in your logs?

Some nice solution for v4 it would be good for me too