Hi,
I am looking at trying to add some form data to a filename?
I cant see where this is done?
I have added some custom code after the upload function but I think this is too late. It changes the name but its not being saved to the the upload array so the physical filename is not changed.
If I do it before the upload the name doesn't seem to exist so there is nothing to change.
Heres the code:
at the minute I the name is: timestamp_filename.jpg
I want someformdata_timestamp_filename.jpg
or can this be done in the "Files config" box in the upload?
Any help would be much appreciated.
Kind Regards
I am looking at trying to add some form data to a filename?
I cant see where this is done?
I have added some custom code after the upload function but I think this is too late. It changes the name but its not being saved to the the upload array so the physical filename is not changed.
If I do it before the upload the name doesn't seem to exist so there is nothing to change.
Heres the code:
<?php $this->data['file1'] = ($this->data['category'].'_'.$this->data['file1']); ?>
at the minute I the name is: timestamp_filename.jpg
I want someformdata_timestamp_filename.jpg
or can this be done in the "Files config" box in the upload?
Any help would be much appreciated.
Kind Regards
I can see that my code actually works (by putting debug before the upload function) but after the upload the bit I added is replaced by a timestamp. I would like my bit as well as the timestamp. Where does it actually add the timestamp?
Also, I was wondering why the filename includes the extension and then the extension is re-added? (filename-jpg.jpg)
Regards
Also, I was wondering why the filename includes the extension and then the extension is re-added? (filename-jpg.jpg)
Regards
Hi Mark,
The easiest way for now is to rename the file after the upload action using PHP code, you can get the file path using this code:
There is currently no other way to build or modify the file name.
Best regards,
Max
The easiest way for now is to rename the file after the upload action using PHP code, you can get the file path using this code:
$this->get("upload_action_name.file_field_name.path");
There is currently no other way to build or modify the file name.
Best regards,
Max
This topic is locked and no more replies can be posted.