TransWikia.com

How to prepend user input data to a filename uploaded through Sprout Forms

Craft CMS Asked by JJefferyDev on September 4, 2021

I have a contact form where users have to fill in a name field and upload a file. I want to add the name the user filled in to the beginning of the filename, eg: firstname-lastname_filename.pdf. I am using Sprout Forms for Craft 3, both the most up to date versions.

Is this something I can do with original Sprout Forms functionality, or will I have to write a custom module or plugin to inject this code? Essentially, what I understand is I will have to find the code in Sprout Forms where the file is uploaded, and inject the code to add the special user submitted name data.

One Answer

Sprout forms has hooks you can latch on to in your own custom module/plugin, so when a form is saved you can grab the asset and re-name at that point.

Answered by dmatthams on September 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP