When a DataForm entry is updated, files that had previously been uploaded into file-type fields are deleted.
I found this bug on one of our production servers (WG version 7.3.22) and replicated it on a WebGUI stable demo site (WG version 7.4.34).
To replicate:
I believe I have found the problem in Form/File.pm. In the function getValueFromPost, value was never getting set properly. I replaced the line:
my $value = $self->get("value");
with:
my $value = ""; $value = $self->session->form->param($self->get('name')) if ($self->session->request);
and now my files do not get deleted on a form entry update. I hope this change does not break anything else that might use Form::File! Patch file enclosed.
-Michelle
The patch as you've submitted it can't be used, as we don't want to trust a storage Id submitted by the user. For existing storage locations, they have to be set to the previous value by the code using the form element.
7.5.11 fixes this bug as part of a rewrite of the DataForm. A different solution will be needed for 7.4.
Testing to see if this fixed in 7.5.11
Verified fixed in 7.5.11