Forums

Create dynamic folder for upload file

doc81 02 Dec, 2020
Hi, I see other post like this and follow the steps suggested, but I can't get the result.

I have a form with name, surname, file upload inputs.
I add a custom code to create a folder with dynamic name and set the upload path:

$nome = $form->data['Nome'];
$cognome = $form->data['Cognome'];
$total_name = $nome.'-'.$cognome .'-'.rand(0,1000);

$path = JPATH_SITE."/images/".$total_name;
$mode='755';

JFolder::create($path, $mode);

$form->actions_config[18]["upload_path"] = $path;

When submit form, the folder is created but the image not uploaded.

If I set the path as JPATH_SITE."/images/" the image is uploaded in this folder.

Are there any problems uploading the file to a newly created folder?

Thanks
Max_admin 04 Dec, 2020
Answer
Use v7, build the path in a PHP action and use the {var:php_name} in the path setting!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.