field_image_fid is trimmed in {content_type_TYPE} table,
the file in {files} table has correct id, and path, but in {content_type_TYPE} table there is fid '20' instead of '220' and '21' instead of '221'
if I manually correct it in database - it's OK, but when I edit the node again with drupal, it gets trimmed again

Comments

alippai’s picture

PS:
D6
CCK-2.0-beta
Imagefield HEAD

alippai’s picture

I found that it creates file with correct id, but after the save (not after the upload) it becomes form '231' to '031' and db it stores as '31'.
I can't find the bug in the code :S

jpetso’s picture

Issue #271017: Wrong fid in DB has been marked as a duplicate.

rapsli’s picture

function content_nodeapi(&$node, $op, $teaser, $page)

$node already has the wrong fid. I though do not know wher this come from?! ... remote debugger for user input would be nice. Didn't get mine to work :(

alippai’s picture

The bug is in the delete checkbox:

$element['delete'] = array(
  '#type' => 'checkbox',
  '#default_value' => 0,
  '#title' => t('delete'),
); 

It overwrites the first char of fid :S

Thank you Heine!

rapsli’s picture

and what would be the fix for it?

rapsli’s picture

added a patch for temporerily fixing this http://drupal.org/node/271862

dopry’s picture

Status: Active » Postponed (maintainer needs more info)

try setting #tree => false on the delete element and let me know if that fixes that for you...

rapsli’s picture

this works for me :) hurray.

rapsli’s picture

Status: Postponed (maintainer needs more info) » Active

this is probably already know, but since we are talking about the deleting issue... deleting actually doesn't work

nonsie’s picture

Deleting doesn't work because $file['flags'] never gets set on delete.

quicksketch’s picture

Status: Active » Closed (fixed)

This seems to apply to a older version of ImageField. The new ImageField doesn't even have a delete checkbox (it's now a button). There aren't any problems with deletion that I know of at this point.