Contact Form 7 - File Upload Change File Name

freelancer

#1

Hello,

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.

Many thanks in advance.

Kind Regards

Ash


#2

Hi you have to ask the plugin author about this


#4

You ever find a solution to this? I have the same need.

-Tim


#5

Hi,

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.