Buy Now
Sign in

FAQ search

How to use file uploads in my edit form ?

Details
Published: Wednesday, 03 December 2014 03:29

In a Connectivity form all fields names have the Model ID, which means that all values are sent under a specific data key in the $form->data array, and in order to be able to handle the file upload of one of the fields, the following config has to be done:

In the "Files Config" box, you will need to use the Model name as the field name, so you can use something like: Model:jpg-png-pdf

Then you will need to write "Model" in the "Arrays fields" box in order to handle all the file fields under the Model key.

This method should work on Chronoforms v5.0.4 and later.

Another solution would be to remove the Model name from the file field (e.g: field1) and use that in the file uploads action settings, but then you will have to move the value of the field under the Model key in the data array using PHP:
$form->data["Model"]["field"] = $form->data["field"];