I have read through the manual and other posts but can not find the answer.
I have a form with 2 field upload options. I would like the file names to have the date and time stamp followed by the first-name and last-name data fields follwoed by the actual name and extension.
If my first name ID is first-name and my last name ID is last-name, how would I write the variable in the 'File name provider' field? I see you can use {var:FN.file.name} and {var:FN.file.extension} but not sure how I combine that to end up with:
{datestamp}{first-name}{last-name}{filename}{file extension}
Thanks a lot
Paul.
You should use the field name but not id, you would need something like this:
{date:YmdHis}{data:first_name}{data:last_name}{var:upload_name.file.name}{var:upload_name.file.extension}Best regards
The 2 files that were uploaded were:
Earthwatch.txt - ended up being '20180307083954PaulSpyker'
logo.jpg - ended up being '20180306155708_logo.jpg'
So the first file was renamed but did not have the extension nor did it keep the original file name.
The second file was not affected and kept the standard naming convention.
My aim is to rename both the files as you have suggested above.
I look forward to your response,
Paul.
The "upload_name" in the string should be replaced by the name of the "upload files" action.
How many file upload actions do you have ?
Best regards
Thanks
Paul.
{date:YmdHis}{data:first_name}{data:last_name}{var:upload2.file.name}{var:upload2.file.extension}
Thanks
Paul.
Great, so the string would be:
{date:YmdHis}{data:first_name}_{data:last_name}{var:upload2.file.name}{var:upload2.file.extension}Best regards
Thanks a lot for your support!
Paul.
{date:YmdHis}_{data:first_name}_{data:last_name}_{var:upload2.file.name}.{var:upload2.file.extension}
Good catch!
Best regards
i join this thread because I'm having some difficulties just in creating file names in a form with multiple uploads.
I need to remove specific characters (minus, underscore, spaces and points) from the names of the uploaded files.
for example the file: 2018-10-01_document aaa.pdf
I have to transform it into: 20181001documentaaa.pdf
I tried using custom php code, that I called strreplace, and I get an array containing the correct file names but I get an error when I insert it {var:strreplace} in File name provider.
result example:
Warning: move_uploaded_file(C:\xampp\htdocs\xxxx\components\com_chronoforms6\chronoforms\uploads\["20181001documentaaa","20181001documentbbb","20181001documentccc"].pdf): failed to open stream: No such file or directory in C:\xampp\htdocs\xxx\libraries\cegcore2\libs\upload.php on line 31
Where am I wrong?
Can I use an alternative method?
Thank you
