Buy Now
Sign in

V6 Dynamic File Folder Upload - " Destination Directory not available"

drgolden , May 06 at 23:51
D
drgolden
I want to save files to folders based on the User Id. In this case the UserId is 649​
In a custom code block after Submit I have:​
<?php $this->set("mypath", "G:\wamp\www\GoldRibbon\components\com_chronoforms6\chronoforms\uploads\Cust{user:id}");​
​?>​
Using custom code block {var.pr:mypath} this prints out correctly as:​
G:\wamp\www\GoldRibbon\components\com_chronoforms6\chronoforms\uploads\Cust649​
​​
​The Upload Directory Path is set to : {var:mypath}​
​​
​On an upload I get the error message "Destination directory not available." The folder definitely exists on my computer.

​The debugger results are:​
​​
​Array​
​(​
​ [option] => com_chronoforms6​
​ [chronoform] => test-copy​
​ [event] => submit​
​ [user_id] => ​
​ [radio8] => n​
​ [file19] => Jennifer A side1.pdf​
​ [aid] => 25​
​ [text1] => don is here​
​ [button2] => ​
​ [Itemid] => ​
​)​
​Array​
​(​
​ [save_data10] => Array​
​ (​
​ [data] => Array​
​ (​
​ [option] => com_chronoforms6​
​ [chronoform] => test-copy​
​ [event] => submit​
​ [user_id] => 649​
​ [radio8] => n​
​ [file19] => Jennifer A side1.pdf​
​ [aid] => 25​
​ [text1] => don is here​
​ [button2] => ​
​ [Itemid] => ​
​ [modified] => 2018-05-06 23:06:56​
​ )​
​​
​ [_success] => Data saved successfully​
​ [log] => Array​
​ (​
​ [0] => UPDATE `chronoforms_data_test` AS `data8` SET `user_id` = '649', `radio8` = 'n', `file19` = 'Jennifer A side1.pdf', `text1` = 'don is here', `modified` = '2018-05-06 23:06:56' WHERE `aid` = '25';​
​ )​
​​
​ [var] => Array​
​ (​
​ [user_id] => 649​
​ [radio8] => n​
​ [file19] => Jennifer A side1.pdf​
​ [text1] => don is here​
​ [modified] => 2018-05-06 23:06:56​
​ )​
​​
​ )​
​​
​ [upload15] => Array​
​ (​
​ [path] => G:\wamp\www\GoldRibbon\components\com_chronoforms6\chronoforms\uploads\Cust649\​
​ [var] => ​
​ )​
​​
​)​
​}​
​​
GreyHead
Hi drgolden ,
Is the folder writeable by the Joomla! user?
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
D
drgolden
The folder is writeable. If I just input the path without using the {user:id} variable it works fine.
In custom code this php statement gets me to the uploads directory
<?php​
​$this->set("mypath1", $path.DS."components".DS."com_chronoforms6".DS."chronoforms".DS."uploads".DS);​
​?>
I think my problem is with syntax. What would be the proper syntax to add "cust" + the {user_id} variable to the end of this statement so the path ends with (assuming the user_id is 649)?:
.../chronoforms/uploads/cust649​