I have a contact form made in “Contact Form 7” in Wordpress. It has a file attach option, which works fine. I want to know if it is possible to rename the file that has been attached based on the input from another field?
There is a section for users to upload the logo for a sponsor at their event. Above the upload there is a text field for the sponsors name. I want the image upload to be renamed to the value of the text field.
This should be a simple tweak shouldn’t it? I need some advise and guidance.
Yes I did find a solution. Unfortunately it required editing the CF7 plugin code, which is usually a big no no. So after very update I have to re-introduce the same edit. But it’s a simple fix for something that still works for the time being.
The file you need to mod is in “modules” folder, and it is the “file.php” file. The lines refering to the variable $filename is what you need to be looking at.
Hope that helps and points you in the right direction.
Hi Underdog.
Do you think you might be able to send me your file.php file? I need to rename files in a specific format using two or three fields entered by the user, and could do with seeing a piece of code that already works.
I’ve set up a temporary mail account at. Would be really appreciated.
I’m very new to Envato forum, and I don’t know how to send direct messages thought the forum. So I sent you an e-mail thought your themeforest profile.
Please note, the $_POST variables should match the fields that you want to rename your file to. If you don’t have a basic understanding of PHP then leave this alone. Also, understand that if you update the plugin this change will be lost.
This is only a quick fix and should not really be looked at as a long term solution.