Is it possible for me to set the upload path programaticly instead of setting it here ?
Developer forum
E-mail notifications
Programmatically Set Upload Path When Using Forms for Editors
Rúni Gudmundarson
Posted on 12/09/2023 10:28:28
Replies
Nicolai Pedersen
Posted on 12/09/2023 11:11:37
This post has been marked as an answer
Hi Runi
There is a secret feature that works something like this:
Any setting on the module when on a paragraph has a name:
In this case the setting in our code is called "FormUploadPath". If you submit a hidden field with the same name, forms module will pickup what you submit and override the setting from the paragraph.
<input type="hidden" name="FormUploadPath" value="{your path}">
You can actually just create the hidden field inside the forms module as type hidden, give the system name 'FormUploadPath' and then override the field value using JS.
Votes for this answer: 1
Nicolai Pedersen
Posted on 12/09/2023 11:12:32
You can also listen to Notifications.Frontend.OnAfterSubmitSave and then move the file to the final location at this point.
Rúni Gudmundarson
Posted on 12/09/2023 11:26:18
First method worked flawlessly. Thanks!
You must be logged in to post in the forum