Developer forum

Forum » Swift » Programmatically Set Upload Path When Using Forms for Editors

Programmatically Set Upload Path When Using Forms for Editors

Rúni Gudmundarson
Reply

Is it possible for me to set the upload path programaticly instead of setting it here ?


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
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 Dynamicweb Employee
Nicolai Pedersen
Reply

You can also listen to Notifications.Frontend.OnAfterSubmitSave and then move the file to the final location at this point.

 
Rúni Gudmundarson
Reply

First method worked flawlessly. Thanks!

 

You must be logged in to post in the forum