Hi every body,
I have a form in which the user enters a gallery name. I also have a "File Field" which allows him to deposit pictures.
In the list of events I have a "Files upload" who save the photos in a directory.
I want to use the name of the gallery to create the directory dynamically and to save the photos there.
I put the code in a custom code and it's ok :
<?php
$path = 'images/phocagallery/' . $form->data['title'];
$mode='755';
JFolder::create($path, $mode);
?>
But, i really don't know how to put the $path in the "Upload path" of my Files Upload...
i test this but it doesn't work : $form->actions_config[1]['Upload_path'] = $path
I search in the forum but, i really don't find.
Thanks a lot for your help.🙂
Fred
I have a form in which the user enters a gallery name. I also have a "File Field" which allows him to deposit pictures.
In the list of events I have a "Files upload" who save the photos in a directory.
I want to use the name of the gallery to create the directory dynamically and to save the photos there.
I put the code in a custom code and it's ok :
<?php
$path = 'images/phocagallery/' . $form->data['title'];
$mode='755';
JFolder::create($path, $mode);
?>
But, i really don't know how to put the $path in the "Upload path" of my Files Upload...
i test this but it doesn't work : $form->actions_config[1]['Upload_path'] = $path
I search in the forum but, i really don't find.
Thanks a lot for your help.🙂
Fred
Hi Fred,
This version has the absolute path - not a relative one - and should work OK
Or you can upload the file to a temporary folder then use a Custom Code action to rename and move it.
Bob
This version has the absolute path - not a relative one - and should work OK
<?php
$path = JPATH_SITE.'/images/phocagallery/'.$form->data['title'];
$mode='755';
JFolder::create($path, $mode);
$form->actions_config[1]['Upload_path'] = $path;
?>
Or you can upload the file to a temporary folder then use a Custom Code action to rename and move it.
Bob
Hi Bob,
the code
Work very well the directory is created and ok.
the code
don't work. The photos is not upload in the directory...i think it is this code "$form->actions_config[1]['Upload_path']"
Because when i write the path directly in the parameter of my Files Upload, it work.
I search. 🤣
Fred
the code
$path = 'images/phocagallery/' . $form->data['title'];
$mode='755';
JFolder::create($path, $mode);
Work very well the directory is created and ok.
the code
$form->actions_config[1]['Upload_path'] = $path
don't work. The photos is not upload in the directory...i think it is this code "$form->actions_config[1]['Upload_path']"
Because when i write the path directly in the parameter of my Files Upload, it work.
I search. 🤣
Fred
Some additions: I modified the code to integrate the id of my field Field Upload Action.
But it doesn't work.
$form->actions_config[13]['Upload_path'] = $path
But it doesn't work.
It's ok now ! thanks, my god, only this mistakes...😑
thanks a lot. Have a goog afternoon.
thanks a lot. Have a goog afternoon.
Hi bob,
I don't know why but it doesn't work again...
The directory is créate = ok
But the photos is in the Chronoforms uploads/form_name/ directory but not in my dynamic directory...
My custom code is before the files upload.
Do you see sommething wrong ? thanks😢
I don't know why but it doesn't work again...
The directory is créate = ok
But the photos is in the Chronoforms uploads/form_name/ directory but not in my dynamic directory...
My custom code is before the files upload.
<?php
$path = 'images/phocagallery/' . $form->data['title'];
$mode='755';
JFolder::create($path, $mode);
$form->actions_config[13]['upload_path'] = $path;
?>
Do you see sommething wrong ? thanks😢
This topic is locked and no more replies can be posted.