Forums

Problem with files upload before and after Model ID setting

SalahChrono 28 Mar, 2017
Hi everybody

I created a simple form (with ChronoForms v5) which contains a text box and a file field,
So, if Model ID parameter is set to its default value (Data):
- The text box value is not saved in the DB table.
- The file field value is also not saved but the file is uploaded to the server.

When Model ID parameter is set to a custom value:
- The text box value is saved.
- The file field value is not saved and the file is not uploaded.

Can you please help me?
GreyHead 28 Mar, 2017
Hi SalahChrono,

If it is a simple form then please try setting Use Model ID to No.

Bob
SalahChrono 29 Mar, 2017
Hi, thank you for your fast reply,
I fixed this problem by adding a hidden field to hold the value of the file field,
And I added a Custom Code action after Files Upload action, this is the code

<?php
  $form->data['model_id']['hidden_field'] = $form->files['file_field']['original_name'];
?>
This topic is locked and no more replies can be posted.