Naming Upload Files

name uploaded files in ChronoForms V5.

Overview

The issue occurs when using incorrect variable syntax in the File Name Code field.
In the Files Upload action settings, ensure the custom file name code uses the correct variable `$file_name` with an underscore.

Answered
bs bsanker 30 Jun, 2015
How do we name the file uploads with V5? With version V4 we could use the file upload GH action. I need the file name to have a set title based on a form field [title]. I have tried to make it just the file name without the date but it returns errors.

Brad
Gr GreyHead 01 Jul, 2015
Hi Brad,

If you scroll down the Files Upload action settings there is a 'File Name Code'box where you can set a custom name.

Bob
bs bsanker 01 Jul, 2015
Bob,

I have tried the file name box. I modified the default code to remove the date <?php return $filename; and I get the error attached.
Gr GreyHead 01 Jul, 2015
Hi Brad,

What did you replace the date code with? If you left it blank then I think that you are creating (or trying to create) files with no name.

Bob
bs bsanker 01 Jul, 2015
Bob,

The default code returns the current date and the existing file name. So If I upload a file called test.pdf it saves it as 201507010841_test.pdf. I am looking for it to only save the file name test.pdf. so I deleted the date field and left the rest of the code.

The only code i am putting in the box is <?php return $filename;
Gr GreyHead 01 Jul, 2015
Answer
Hi Brad,

I think that needs to be
<?php return $file_name;
with an underscore.

Bob
bs bsanker 01 Jul, 2015
Its amazing how the little things can be such a big problem. That worked. Thanks Bob.
This topic is locked and no more replies can be posted.