File upload invalid argument
easpegren - July 1, 2008 - 20:49
| Project: | Webform |
| Version: | 6.x-2.1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
After adding an image to the webform I get an invalid argument error. The webform works correctly if a file is not attached.
I have tried submitting several different file types and from different locations and have received he same error.
I am running Drupal 6.2 on MAMP.
| Attachment | Size |
|---|---|
| Picture 1.png | 30.84 KB |

#1
I'm not experiencing this same issue. Some more information might be necessary. The following things might be help:
- Is this a multipage form
- Does the file upload anyway
- Does this only happen when the validation would fail, or on every file
- Could you screenshot your file component configuration
Apologies for the DMV list, I just can't reproduce it on my install.
#2
This is a simple one page form. I am doing some testing and I added a date, email, and file upload field. The form gets submitted correctly, but the file does not upload. Even the smallest 4k file gives the error.
I can upload files correctly if they are attached to pages using the upload module.
The problem appears to be happening on every file. Files that should validate correctly also post the error. Files that I try to upload that are too large or are the wrong format do not validate and shows the correct error message.
I attached a screenshot of my file component config file.
I have disabled all modules except for the core modules that were enabled upon Drupal installation.
#3
I have the same error.
I add string to common.inc before line 796
if (!is_array($args)) return $string . (is_string($args)? ' Args: ' . $args: '');And get error (see attached screenshot), but the directory exists in real and has all permissions.
#4
I committed two fixes which I think will solve this problem. First, there was a problem with the error message when the file directory didn't exist or was not writable. Second, I made Webform attempt to create the files directory in a more reliable manner. If you can either try out the dev version to confirm the fix, or try using this patch, we can see if this has fixed the problem.
D5: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/webform/com...
D6: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/webform/com...
#5
The changes in patch helps me to fix this problem.
The string
$upload_dir = variable_get('file_directory_path', 'files') ."/webform/". $component['extra']['savelocation'];mast be
$upload_dir = variable_get('file_directory_path', conf_path() .'/files') ."/webform/". $component['extra']['savelocation'];Now it works!
#6
Thanks mrjavum, I missed that one and corrected that line also. Strangely it was already fixed in Drupal 5, but needed correcting in D6.
http://cvs.drupal.org/viewcvs/drupal/contributions/modules/webform/compo...
#7
#8
Automatically closed -- issue fixed for two weeks with no activity.