Forums

Rename file on upload

Warren.Kessler 26 Aug, 2022
I have recently updated to CF7 and in the process of updating most of my forms from CF5. I am having trouble figuring out how to rename a file that is being uploaded. I would like use the information of the name fields in the form to rename the file.

in CF5 I used this code in the File Upload action > File name code:
<?php
return $form->data['FirstName'].'-'.$form->data['LastName'].'-'.date('Y-m-d_His').'.jpg';
?>

I am thinking i need to use the File name provider in CF7 so I tried this, but not doing anything.
{data:FirstName}-{data:LastName}-{date:Y-m-d_H:i}.{var:photo.file.extension} 

Any help is appreciated.

Thanks,
Warren
You need to login to be able to post a reply.