When a submission is edited, file upload fields don't keep files that have been previously submitted.
This manifests in two ways: If the file upload fields are set as required, then you cannot edit and re-submit the webform without re-uploading a file for each field. If the file upload fields are not set as required and any field is left empty, then any previously uploaded file for that field is removed.
I'm attaching a patch that makes two key changes:
1. File upload fields keep the currently attached file when a webform is submitted and no new file is uploaded.
2. If no new file is uploaded to a file upload field, but the field has a file from a previous submission, then it passes validation for being required.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | issue431120.patch | 2.06 KB | attiks |
| webform-file-keep_submission.patch | 2.82 KB | arithmetric |
Comments
Comment #1
arithmetric commentedComment #2
attiks commentedGot the same problem so I changed file.inc based on patch given above
Comment #3
matt2000 commentedPatches fix the issue nicely.
FTR, I tested the 5.x patch on a real install. 6.x version got visual review only.
Comment #4
bigmotard commentedSo, the question now is how with this patch you can delete a file that had been committed and leave again a field blank.
Comment #5
luke.anderson commentedI submitted this at http://drupal.org/node/461946#comment-3311084, but I suspect it actually belongs here:
Is there a way to allow users (admins only in my case) to browse the server for files to be uploaded into a webform, instead of only allowing them to browse their local machine?
My situation is that users are submitting files, and admins are editing the submissions and re-saving them; however, without this patch for D6 the files are not re-included by default. I'd like to give admins the ability to browse the server to re-attach uploaded files more easily.
Comment #6
quicksketch@luke.anderson: If you have a question separate from the current topic, you should open a new issue. Re-using files (a feature request) has little overlap with files being lost on edit (a bug report). Most likely your request would be solved by #289919: Provide AJAX-based file uploads/Progress Bar for uploads, in combination with a module like FileField Sources. Currently it's not at all possible in Drupal 6.
Comment #7
luke.anderson commentedOK, thanks. Sorry.
Comment #8
quicksketchI've ended support for Drupal 5 and the 2.x branch. This won't ever be committed.
Comment #9
vood002 commentedThis remains a bug in 6.x-3.xMy mistake, it's not still a bug