Closed (fixed)
Project:
Webform
Version:
7.x-3.13
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Jun 2011 at 16:55 UTC
Updated:
22 Dec 2011 at 06:41 UTC
Jump to comment: Most recent file
Hello,
We have encountered the following bug which forced us to deactivate the "Save as draft" feature on our webform. It happens with a file field. Even if the field is mandatory when :
- user goes to webform
- user uploads content in file field.
- user clicks save as draft.
- user clicks submit.
Then the file field is deleted.
Thanks for looking into it!
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | git-history.png | 131.04 KB | quicksketch |
| #8 | webform_file_draft.patch | 607 bytes | quicksketch |
Comments
Comment #1
vernond commentedFor the clarity of my understanding of the problem, are you saying that after a user has browsed to the file to upload, and then clicks on Save as Draft that this causes the 'browsed to' filename to disappear from the file field? If so, then this possibly more of an HTTP limitation than a Webform issue as such.
Comment #2
jun commentedHi Vernond,
Yes this is happening, but I think this limitation of HTML/HTTP is usually worked around by using things like hidden fields (which in the case of file fields require some extra work to keep track of the id of the uploaded file in Drupal, since there should be no reason to upload the file again).
In other words, yes it is a limitation, but to my knowledge it can be dealt with.
Comment #3
vernond commentedWhoops, I get a similar result when there's a validation error on the page as well (i.e. file browsing text disappears).
I agree, there must be some elegantly simple and monumentally effective way of dealing with this, but it falls well within my ignorance zone at this time. I'll see if I can dig up anything useful and post back here in a day or few.
Comment #4
quicksketchRegarding the file being lost on a validation error, that's a separate issue over here: #322786: File attachment lost after validation error
Webform already has the ability to save a file via a hidden field and show the file name below the upload field in the event that you are viewing, editing, or resuming an existing submission. I'm guessing there's a bug in our handling of drafts that prevents this from working correctly.
Comment #5
mjwright commentedI've added a patch to my version (6.x-3.11) that seems to solve the problem. In components/file.inc at line 504, I changed this code:
to this (don't delete the file if _old == _fid):
Comment #6
quicksketchOoo, nice one. Looks like it could work to me. I'll need to test this out to make sure there isn't some other code that should be solving this problem, but that change looks like a nice safety-catch in any case.
Comment #7
dunwich42 commentedI could be getting this one as well.
Comment #8
quicksketchI've tested this patch out in both Drupal 6 and Drupal 7 (which both had the problem) and it corrects both of them. Thanks mjwright! I've made it into a patch (attached here) and committed it to both branches of the Webform project.
Comment #10
wheels394 commentedI getting this same issue on 6x-3.14, attaching a file but losing it when save draft is used. What's weirder is the link to the file is showing up in the email but leads to a page not found and the file is not found in the database or results.
Comment #11
bayousoft commentedI am finding that files are saved the first time you 'Save Draft' but are lost if you 'Save Draft' a second time without re-uploading.
Comment #12
quicksketchSorry this fix was *not* in 3.12 or 3.13. I even committed my changes before 3.13 was released, but the 3.13 release wasn't made off of the "master" or 6.x-3.x branch, so the change wasn't included. This will be in the 3.15 versions for both D6 and D7.
Comment #13
quicksketchAttached is a GitX screenshot of the changelog so you can see how this happened.