File uploads are failing with this error:

user warning: Field 'fdesc' doesn't have a default value query: INSERT INTO webfm_file (fpath, uid, fsize, fcreatedate, perm, fmime) VALUES ('C:\\Inetpub\\Drupalfiles\\default/files/test.wmv', 1, 12973, 1231956995, 0, 'video/x-ms-wmv') in C:\Inetpub\Drupal\includes\database.mysql.inc on line 174.
Could not insert C:\Inetpub\Drupalfiles\default/files/test.wmv into the database
Insertion into database fail

System setup is Drupal 5.x on Windows 2003 with IIS6.

IUSR_name does have full access to the sites temporary directory and the location where files are to be stored.

Comments

phen’s picture

I had this problem too. I resolved it by modifying the 'fdesc' field, changing "NOT NULL" to "NULL". Seems to work, though I suppose I could be causing subtle problems. I doubt it. Run some SQL on your database similar to the following:

ALTER TABLE `webfm_file` CHANGE `fdesc` `fdesc` TEXT  NULL

hope this helps.

meichr’s picture

Status: Active » Needs review
StatusFileSize
new481 bytes

In version 6.x-2.11 this problem has been addressed in the module by setting the field 'fdesc' to a default value of '' if not set, so I'd suggest to backport this behaviour into the 5.x-2.15 version too. With the attached patch the 5.x-2.15 version can be patched with the 6.x-2.11 solution.

resting’s picture

I have this problem too using webfm-5.x-2.15.
How do I apply the patch?
Am I supposed to take the codes in the patch file and paste into webfm.module??
Thanks

cgmonroe’s picture

For how to apply a patch to a Drupal module see:

http://drupal.org/patch/apply

An alternative for simple patches (like this one) is to open the patch file (it's only text) to look at the changes made. Here's what the patch files looks like: (Note that learning to do a proper patch is best as most patches have lots of changes.)

--- webfm.module	2008-10-17 19:14:49.000000000 +0200
+++ webfm.module    	2010-02-22 02:10:07.000000000 +0100
@@ -2583,6 +2583,8 @@ function webfm_dbinsert_file($file, &$er
     $metadata['perm'] = webfm_default_file_perm();
   if(!isset($metadata['fmime']))
     $metadata['fmime'] = webfm_mime_type($file->filepath);
+  if(!isset($metadata['fdesc']))
+    $metadata['fdesc'] = '';
 
   //create a string of fields for the query
   $fields = implode(', ', array_keys($metadata));

The --- and +++ lines indicate the file being modify (e.g. webfm.module)

The @@ lines will indicate the approx. line number to change and if possible the function that contains it (e.g. about 2583 in webfm_dbinsert_file).

The + lines indicate the lines to add. (- would indicate lines to delete). DO NOT ADD THE + or - part.

The untagged lines are the lines above and below the code change. E.g., the lines above the two lines to add would be:

     $metadata['perm'] = webfm_default_file_perm();
   if(!isset($metadata['fmime']))
     $metadata['fmime'] = webfm_mime_type($file->filepath);

So the patched section of code would look like:

    $metadata['perm'] = webfm_default_file_perm();
  if(!isset($metadata['fmime']))
    $metadata['fmime'] = webfm_mime_type($file->filepath);
  if(!isset($metadata['fdesc']))
    $metadata['fdesc'] = '';
 
  //create a string of fields for the query
  $fields = implode(', ', array_keys($metadata));
nhck’s picture

Status: Needs review » Fixed

Fixed in CVS.

Status: Fixed » Closed (fixed)

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