How can a fieldname be appended to uploaded filename?

kylebonham 05 Jun, 2011
Users upload images that all go to the same folder and I can only separate them by viewing thumbnails. What would be the format to append a fieldname to the filename?

I tried a few methods which didn't work including
$filename = $chronofield['yourname'].'_'.date('YmdHis').'_'.$chronofile['name'];

Using version 3.2.0
J1.5.23
LAMP
GreyHead 05 Jun, 2011
Hi kylebonham,

It's quite tricky to get working reliably. Here's a possible route:
$filename = JRequest::getCmd('text_0', 'blank', 'post').'_'.date('YmdHis').'_'.$chronofile['name'];

NB getCmd() is used to strip out any characters that are not permitted in file names.

An alternative is to rename the file after it's uploaded.

Bob

PS I have a longer document looking at variable file and folder names for ChronoForms v3 that can be bought here.
This topic is locked and no more replies can be posted.