WebGUI
      Click here to register.
      
Sprechen Sie WebGUI? Parlez vous WebGUI? Se habla WebGUI? Spreekt u WebGUI?

Do you speak WebGUI? Please help us translate WebGUI into your language.



     Report a Bug > WebGUI Bug Tracker

Data Form deletes files on resave

User mlamar
Date 4/24/2008 4:32 pm
Severity Critical (mostly not working)
Version WebGUI Stable 7.4.34
Views 105
Rating 0    Rate [
|
]
Karma Rank 0.000000
Previous · Next
User Message
mlamar

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: 

  1. Create a DataForm with two fields: one text area type and one file type
  2. Commit your version.
  3. Add an entry in the DataForm by uploading a file into the file field and saving.
  4. Go to list all entries and click on the entryid to edit the entry.
  5. Change the text in the text area field (don't touch the file field).
  6. Save.
  7. Look at the entry again (via list) and see that the file is gone.


Back to Top
Rate [
|
]
 
 
mlamar


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



Attached Files
Back to Top
Rate [
|
]
 
 
Graham

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.



Back to Top
Rate [
|
]