cforms II User Forum

Registration is currently disabled.


Login form protected by Login LockDown.

Lost password?
Advanced Search

— Forum Scope —


— Match —


— Forum Options —


Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS Related Topics
Rename the attachment filename
June 2, 2012
11:35 am

Hy all,


i´m new to this very very good form-mailer – thx to oliver and all the others for developing it.


What i need is maybe a simple thing:


When an attachment with a personal name like: "here-comes-my-personal-picture.jpg" will be uploaded, then it has to be stored like "01-picture-upload.jpg" and






for the next pictures – so there is a little bit of "anomysing" the name of the pictures – but where do i rename it in the code in my-functions.php – i´m so new to cforms so i didn´t see it (in the moment…).


to receive a litte tip were great.



June 2, 2012
1:12 pm
Munich, Germany
Forum Posts: 6400
Member Since:
March 6, 2005

the number part you could have cforms do for you, the benefit: it'll be in sync with the record id of the submission (see upload options).

renaming can be done in two different ways, see my-functions.php & look for 

  • "filename"
  • or "fileDestination" & "fileDestinationTrackingPage"
June 3, 2012
11:39 pm

Hy Oliver,


thanks for your reply, i´ve seen it in my-functions.php – but it would not work… – i´ll do not know where i could aktivate the setting-value – with a hidden field?

June 24, 2012
7:50 am
Munich, Germany
Forum Posts: 6400
Member Since:
March 6, 2005

Depending on your PHP coding skills, you may want to seek support from a developer.

Like I mentioned Peter, it's all in my-functions.php and you need to uncomment the proper coed segments there and simply adjust the existing code to match your requirements…

August 3, 2012
3:51 am
Dan Tabibzadeh

Dear Peter,

I just fixed this issue for myself, and I wanted to shed light to you on how to do this (and anyone else looking to remove the "prefix" before your uploaded file's name, ie: 22-filename.jpg):

1. Open up your FTP program and locate my-functions.php (usually in wp-content/plugins/cforms). Download this file to your computer.

2. Open my-functions.php with Notepad (or Word, doesn't matter)

3. Press CNTRL + H (or Edit – > Replace) and input $newArray['name'] = $submissionID . '-' . $oldvalue['name'];

4. Replace that with $newArray['name'] = $oldvalue['name'];

5. Upload this newly-edited my-functions.php file to the same place where you downloaded it from (overwrite the old version – important)

And voila! No more "##-" before your uploaded files!

Enjoy :) 

August 25, 2012
10:53 am
Munich, Germany
Forum Posts: 6400
Member Since:
March 6, 2005

well done.

re step 5: you might want to save your custom my-functions.php file to plugins/cforms-custom/ that way, even when you upgrade you don't accidentally overwrite it.

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
24 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3757

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5355

Posts: 18732

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)