Closed (fixed)
Project:
Webform
Version:
5.x-1.7
Component:
Miscellaneous
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Nov 2007 at 20:53 UTC
Updated:
12 Feb 2008 at 15:52 UTC
Jump to comment: Most recent file
Comments
Comment #1
mkalbere commentedGot the same problem when file is required. I succeed to make it work with the following changes.
Everythings seems to be ok, but I've no idea if this change is clever ;-)
Comment #2
mzabala commentedAlso, when I use a file attachment field, if I try to add another field after that, it takes me to a 404 "page not found" error page. However, the URL that pulls up is.
http://www.[mydomain].com/node/[nodenumber]/edit
if I simply go up to the address bar and hit enter and go to the same url, the webform edit page reappears instead of giving me the page not found error previously mentioned.
Also, it seems impossible to add two file attachment fields. In fact, trying to add two not only sends me to page not found, but it seems to remove my first one.
Comment #3
eer commentedSame problem here. A few more observations:
It's impossible to edit a file field after it's created.
It's impossible to add a second file field.
File is not being uploaded when it's either required or not required. (And produces an error message when it's required.)
Comment #4
Gentoo7 commentedI am coming across this problem. There is no link in the email and if i browse at the location where these files should reside there no files there either.
Comment #5
Gentoo7 commentedDoes anyone know how to fix this issue, so we can attach files?
thanks
Comment #6
laxis commentedWith this patch the file uploading is work.
Comment #7
mkalbere commentedYou forgot to patch a part of the file cf patch#1 bellow. I don't think it's usefull to post twice the same changes ;-)
Comment #8
Gentoo7 commentedafter the changes from the patch the files download great!!!
but is there anyway to receive a link within the email for the location of the file.
thanks a lot!!!
Comment #9
eer commentedThe patch(es) do not seem to work for file fields which are not mandatory. Still same problem: cannot add more than one field and other problems as well.
Comment #10
Gentoo7 commentedhey eer,
I'm no programmer but this are how i fixed my file.inc (i just changed to the patch that laxis posted) and it works for me, maybe try to replace your file.inc by copy and paste this
code. the file.inc file is located under components folder. The only problem is that when you receive the form email THERE ARE NO LINKS to the
uploaded files, so for now i have to manually go and search for the uploaded file, which becomes very confusing if you have a lot
of files being uploaded.
Here is my file.inc :
Comment #11
rba commentedmkalbere's patch ( http://drupal.org/files/issues/diff_8.txt ) does the job, whether or not the field is mandatory.
laxis, your patch does NOT work in every situation : it only fixes the behavior of the "_webform_submit_file" function while you also need to fix how "_webform_validate_file" and "_webform_required_file" functions access the uploaded file in the $_FILES array ... which mkalbere's patch does.
The three functions try to access the uploaded file in the $_FILES['files']['name'][ $component['cid'] ] - where $component['cid'] is the internal component id, eg: "1198777242" - where actually, the uploaded file info will be stored in $_FILES['files']['name'][ $component['form_key'] ].
$component['form_key'] is whatever you typed as the "Field Key" when you added the "file" component field to the form.
( Actually, since "Field Key" is initially valued to the $cid, you won't see the problem if you don't change its value ).
mkalbere's patch is not perfect, because he used a shortcut : since "_webform_validate_file" and "_webform_required_file" have $cid as an argument and that $cid ( == $component['cid'] ) is used numerous times where a $form_key ( == $component['form_key'] ) should be used, he simply changed the $cid value to the $form_key value in the function "calls" ( lists of the two functions arguments in the "_webform_render_file" function ).
Hence, he did not have to modify "_webform_validate_file" and "_webform_required_file" function definitions nor code.
But it *might* lead in some confusion in the future, so I'd let the module maintainers decide how to integrate it in the trunk.
eer> roll back your modifications on the code of the module (getting a fresh copy of the source code from here, for instance) and then apply mkalbere's patch.
Gentoo7> you should do the same as Iaxis' patch, unfortunately, is not covering all use cases.
Comment #12
quicksketchThanks, I applied mkalbere's patch and it correct the problem with the file not saving. The file does not yet show up in the email.
Comment #13
quicksketchI shuffled around the processing of file components so that the file URL is properly sent in webform email. Thanks everyone!
Comment #14
eer commentedSorry for opening the issue again but it's not fixed here what a pity.
I have just uploaded the latest preview version (January 19, 2008) of the plugin. I have created a new webform. Then I added a file field successfully. Then I tried to add another file field and get back nothing, the system tried to process the request and I finally got a blank page. When I again go to the Edit page, I only see the previously added file field and not the new one I tried to add. BTW, both fields were non-mandatory.
Any suggestions?
Thanks.
Comment #15
eer commentedWell, this has been fixed after I upgraded my PHP version from 4.x to 5.x in my GoDaddy account.
Comment #16
quicksketchExcellent. Since PHP4 is officially unsupported, I'll close back up.
Comment #17
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.