Create dynamic folder for upload file

How to upload files to a dynamically created folder in ChronoForms.

Overview

The issue occurs because the upload path is set after the folder is created, but the file upload action may not recognize the new path variable.
Build the dynamic folder path within a dedicated PHP action, then reference the generated path variable directly in the upload action's path setting using the correct placeholder syntax.

Answered
ChronoForms v5
do 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 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.
This topic is locked and no more replies can be posted.