Hi,
I'm working on a form where members are signing up. one of the fields is for them to upload their company logos. What I want to be able to do is insert their comapny name (its a field in chronoforms called "trading_as") at the very start of the filename.
What would I need to enter in the "FileName Format" field to do this?
Thanks
I'm working on a form where members are signing up. one of the fields is for them to upload their company logos. What I want to be able to do is insert their comapny name (its a field in chronoforms called "trading_as") at the very start of the filename.
What would I need to enter in the "FileName Format" field to do this?
Thanks
Hi Zeon,
I'm not 100% certain. Try
Bob
I'm not 100% certain. Try
$filename = JRequest::getString('trading_as', 'no_name_entered', 'post');Bob
Works great thanks!
Just a tip to anyone reading this - the form fields are case sensitive!
Just a tip to anyone reading this - the form fields are case sensitive!
This is what I have tried. I have people that have an ID and the pictures I want to have their ID.jpg. I have tried the following, but it is not working.
$filename = JRequest::getString('ID', 'no_name_entered', 'post');
$filename = JRequest::getString('ID', 'no_name_entered', 'post');I modified this code with this$filename = JRequest::getString('ID', '', 'post');and it works only without the extension. How do I get the .jpg extension on the end?
Hi kclark,
Try this:
/Fredrik
Try this:
$filename = JRequest::getString('ID', '', 'post') . '.jpg';/Fredrik
Hi kclak,
Just adding to Fredrik's post if you have uploads with different suffixes (maybe jpgs and pngs) then you can automate the suffix with
Bob
PS I'd also suggest that you add a default value in case ID isn't set for some reason like: JRequest::getString('ID', 9999, 'post'). This will avoid any files named '.jpg'.
Just adding to Fredrik's post if you have uploads with different suffixes (maybe jpgs and pngs) then you can automate the suffix with
$filename = JRequest::getString('ID', '', 'post') . '.' . JFile::getExt($chronofile['file_0']);Where ['file_0'] needs to match your file input name.Bob
PS I'd also suggest that you add a default value in case ID isn't set for some reason like: JRequest::getString('ID', 9999, 'post'). This will avoid any files named '.jpg'.
just tried; actually if you replace ['file_0'] by the file imput name, it doesn't work.
But it works with
But it works with
JFile::getExt($chronofile['name'])
1 mistake / 1000+ resolved topics, it's a good ratio, don't worry😉
Hi,
I tried this to put the auto genereated cf_id in front of the date and filename:
It does not work, the first part with the cf_id is not in the filename.
What is wrong?
it should work with other field values out of the form, lile 'text_1' and so on?
Thanks in advance,
Malte
I tried this to put the auto genereated cf_id in front of the date and filename:
$filename = JRequest::getString('cf_id', '', 'post').date('YmdHis').'_'.$chronofile['name'];It does not work, the first part with the cf_id is not in the filename.
What is wrong?
it should work with other field values out of the form, lile 'text_1' and so on?
Thanks in advance,
Malte
Hi malte,
Normally the cf_id isn't created until after the file upload is complete so you can't use it here. It's also not a form input so the JRequest syntax won't find it.
Bob
Normally the cf_id isn't created until after the file upload is complete so you can't use it here. It's also not a form input so the JRequest syntax won't find it.
Bob
Ok, thanks.
I removed the cf_id and replaces it with a value of a textfield like
Thanks again!
Great support!!
I removed the cf_id and replaces it with a value of a textfield like
$filename = JRequest::getString('text_2', '', 'post').'_'.date('YmdHis').'_'.$chronofile['name'];Thanks again!
Great support!!
This topic is locked and no more replies can be posted.
