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.

CommentFileSizeAuthor
#3 Clipboard02.jpg12.33 KBmrjavum
#2 Picture 1.png67.03 KBeasp
Picture 1.png30.84 KBeasp

Comments

quicksketch’s picture

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.

easp’s picture

StatusFileSize
new67.03 KB

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.

mrjavum’s picture

StatusFileSize
new12.33 KB

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.

quicksketch’s picture

Status: Active » Needs review

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...

mrjavum’s picture

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!

quicksketch’s picture

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...

quicksketch’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.