Hello all,
For my CC list I created a ChronoForm to edit a record. For this I used this tutorial:
Everything is working great but now I want to add a file upload, so I can add an image to the edited record. With the static upload path everything is working great, but I would like to have a dynamic path for it.
I came across this tutorial:
http://www.chronoengine.com/faqs/53-cfv4/cfv4-file-uploads/2630-how-can-i-upload-files-under-some-users-folder.html
Very helpfull, but I don't want to upload the file under some users folder, I want to upload it to the year that is used in the edit form.
In CF, in the Designer tab, I have a input field with the name "movements_ewas[year]" (without ""). This is how my date lookes in the edit form:
[attachment=0]CF_date.png[/attachment
I also have a file upload element.
In the Setup tab I have a custom code [b]before[/b] the file upload and it has this code:
In the example image above the year is 2014. So when I want to upload a file to that record, the file has to be uploaded in the 2014 folder (in images/movements). This part isn't working.
After the custom code I have a file upload. In there I left the upload_path emtpy.
So when I test my form, the filename is stored in the database, but the file isn't uploaded.
I think I am doing something wrong with the custom code....
Hope someone can help me.
Regards,
Ruud
For my CC list I created a ChronoForm to edit a record. For this I used this tutorial:
Everything is working great but now I want to add a file upload, so I can add an image to the edited record. With the static upload path everything is working great, but I would like to have a dynamic path for it.
I came across this tutorial:
http://www.chronoengine.com/faqs/53-cfv4/cfv4-file-uploads/2630-how-can-i-upload-files-under-some-users-folder.html
Very helpfull, but I don't want to upload the file under some users folder, I want to upload it to the year that is used in the edit form.
In CF, in the Designer tab, I have a input field with the name "movements_ewas[year]" (without ""). This is how my date lookes in the edit form:
[attachment=0]CF_date.png[/attachment
I also have a file upload element.
In the Setup tab I have a custom code [b]before[/b] the file upload and it has this code:
<?php
$year = $form->data['movements_ewas']['year']);
$form->actions_config[3]["upload_path"] = "/home/sites/xxxx/images/movements".DS.$year.DS;
?>
In the example image above the year is 2014. So when I want to upload a file to that record, the file has to be uploaded in the 2014 folder (in images/movements). This part isn't working.
After the custom code I have a file upload. In there I left the upload_path emtpy.
So when I test my form, the filename is stored in the database, but the file isn't uploaded.
I think I am doing something wrong with the custom code....
Hope someone can help me.
Regards,
Ruud