cannot update fileupload element using "updateFormData"

p38

Active Member
I have an element 'im_clients___downloader_settings' and is a fileupload element.

It seems as though fabrik does not allow element value updates using

$formModel->updateFormData('im_clients___downloader_settings', $snapshot, true);

Is there any way you can allow this please?

Paul.
 
What exactly are you trying to alter?
In general image data is dealt with differently as it is contained with in PHP's $_FILES global array and not in the $_POST array that normal fields text is contained within. So updating formData() won't have an effect on the $_FILES array
 
Elsewhere in my system, I upload images and create thumbnails via ftp.

The only way I gather I can show thumbnails, or popup images in fabrik is via the fileupload element. (this shows a thumb in list, and if you click, it shows original image).

So in order for this to happen, I use PHP in my form to put the image URL in the fileupload element field value and voila........ I have images in my list.

Now if I can only get this to work........... do you have an alternative for me?

PS: it is not only images I have, but files as well, so I cannot use an image only type element

Paul
 
ok thanks for explaining that further, from your original post I was under the impression you wanted to update the information inside a file that was uploaded as part of the form.
Now if I understand correctly you just want to edit the path name of the image that is stored in the database table?

When exaclty are you trying to use the formModel->updateFormData() method? Can you give me full steps that I can replicate to replicate the issue. At a guess I would say you are trying to do it too early in the upload process and that the fileupload element is subsequently replacing your custom data when the plugin itself calls updateFormData()
 
I call the formModel->updateFormData() at the "Start of form submission (onbeforeprocess)

The file upload element is set to display only, in other words, the user cannot use the file upload in the form, it merely displays the content.

I have another application the uploads the images and thumbs into a location, and this location is updated using the above method and this code below.

$snapshot = 'im/clients/{$my->username}/{$my->username}_snapshot.jpg';
$formModel->updateFormData('im_clients___display_screen_snapshot', $snapshot, true);

In this way, I can be sure the pathname of the image is correct, without any intervention from the user.

I can understand that if the fileupload element was in edit mode, that the file path might be overwritten with an update statement, however, I assumed that because the element is in readonly/display mode, then no updates or value changes are done, so my code would be safe.

paul.
 
Thanks Rob, this did the trick. So it looks like I was updating too early in the chain with onbeforeprocess

Paul
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top