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.

AttachmentSize
Picture 1.png30.84 KB

#1

quicksketch - July 1, 2008 - 23:10

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

easpegren - July 2, 2008 - 13:45

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.

AttachmentSize
Picture 1.png67.03 KB

#3

mrjavum - July 4, 2008 - 11:15

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.

AttachmentSize
Clipboard02.jpg12.33 KB

#4

quicksketch - July 8, 2008 - 02:45
Status:active» patch (code 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...

#5

mrjavum - July 9, 2008 - 04:52

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

quicksketch - July 9, 2008 - 14:31

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

quicksketch - July 12, 2008 - 22:03
Status:patch (code needs review)» fixed

#8

Anonymous (not verified) - July 31, 2008 - 04:47
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.