This is causing the following issue in the dRealty project: http://drupal.org/node/1020534

The module sets the filefield to an empty array, and then adds a new array of files and saves the node. The new files are deleted. I've been testing this quite a bit, and think the issue has to do with the files being compared in the wrong order. The files supplied by the cck update hook (in &$items) are from the original node, and the files obtained by loading the node on line 190 are from the new node.

When I add logging statements to the code, $oitem['fid'] is always greater than any of the fids in $curfids. This is why I'm thinking they are being evaluated in the wrong order.

Here's a summary of all the work I've done trying to debug this: http://drupal.stackexchange.com/questions/8064/cck-filefield-updating-im...

Comments

arosboro’s picture

Version: 6.x-3.9 » 6.x-3.10

This also applies to 6.x-3.10, since the filefield_field_update function hasn't changed.

arosboro’s picture

Here are the lines of code where dRealty sets the filefield array. $node->dr_images is the filefield.

http://pastebin.com/rXmQqwC5

newnewuser’s picture

#2 link is very helpful. thanks

quicksketch’s picture

Status: Active » Closed (won't fix)

Looks like dRealty IDX is EOL for D6. If there's an actionable suggestion here I can take another look, but a general request to change the architecture of FileField isn't very practical at this point.