When I upload the photo (the ImageField module enabled, using 6.x-3.x-dev(from 2008-Dec-03) and 6.x-3.0-alpha2 both), I found an error when deleting the image -

Fatal error - call to undefined function _filefield_default_value() in ... line 195

I can't give ypu more information yet.

I am using the 6.x-3.0-alpha5 and used 6.x-3.x-dev from 2008-Dec-04 and I have the same error in all cases.

Can you fix the error? Thanks!

CommentFileSizeAuthor
#1 error.png54.94 KBandyceo

Comments

andyceo’s picture

StatusFileSize
new54.94 KB

may be this error have the same reason like this one - http://drupal.org/node/346150

I've got the messagebox with the error text. You can see a screenshot I attached.

andyceo’s picture

Okey, I found out an error...

It is in file filefield_widget.inc, line 195:

  // check remove buttons...
  $remove_name = $element['#field_name'] .'_'. $element['#delta'] .'_remove_btn';
  if (isset($form_state['clicked_button']) && $form_state['clicked_button']['#name'] == $remove_name) {
    $item = _filefield_default_value($field);
  }

Line 195 is :

    $item = _filefield_default_value($field);

Well, the function name is wrong, and I fix it:

    $item = filefield_default_value($field);

The function filefield_default_value() is defined in filefield.module file in line 507:

function filefield_default_value(&$form, &$form_state, $field, $delta) {

So when I fix the function name in filefield_widget.inc, I have the following warnings, deleting the image:

warning: Missing argument 2 for filefield_default_value(), called in /home/andyceo/hosts/drupal6/sites/all/modules/filefield/filefield_widget.inc on line 195 and defined in /home/andyceo/hosts/drupal6/sites/all/modules/filefield/filefield.module on line 507.
warning: Missing argument 3 for filefield_default_value(), called in /home/andyceo/hosts/drupal6/sites/all/modules/filefield/filefield_widget.inc on line 195 and defined in /home/andyceo/hosts/drupal6/sites/all/modules/filefield/filefield.module on line 507.
warning: Missing argument 4 for filefield_default_value(), called in /home/andyceo/hosts/drupal6/sites/all/modules/filefield/filefield_widget.inc on line 195 and defined in /home/andyceo/hosts/drupal6/sites/all/modules/filefield/filefield.module on line 507.

Image physically not deleted, but the field become empty.

Please, fix this bug till the end :)

andyceo’s picture

Okey...

I have fixed this bug.

File filefield_widget.inc, line 195:

    $item = _filefield_default_value($field);

Update the line 195 by following:

    $item = filefield_default_value($form, $form_state, $field, $delta);

It's work, the field become empty. But uploaded files physically NOT DELETED. I don't know, perhaps the author made this behavour especially.

duntuk’s picture

thanks andyceo.

btw, the not removing files issue has been a problem for a while now... i recall seeing this sometime ago discussing the subject.

mfb’s picture

Status: Active » Closed (duplicate)