Similar to the CCK migration thing I posted before I found a peculiarity dealing with filefield and nodeapi - for some reason, it didn't actually update the filefield until I ran a separate node_save()...
<?php function archivalcollection_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { if ($op == 'presave') { switch ($node->type) { case 'archivalcollection': if ((empty($node->field_arms_pdffile[0]['fid']) || $node->field_arms_pdffile[0]['fid'] == 0) && !empty($node->field_arms_amat_printfindingaid[0]['value'])) { $pdfurl = $node->field_arms_amat_printfindingaid[0]['value']; $pdfpath = file_directory_path() .'/archivalcollections/pdf'; $tmppath = file_directory_temp(); $tmpfile = $tmppath.'/'.basename($pdfurl); if (!$pdfdata = file_get_contents($pdfurl)) { watchdog('AMAT Migration', "nid $node->nid - Could not read $pdfurl", NULL, WATCHDOG_ERROR); } elseif (!$tmppdf = file_save_data($pdfdata, $tmpfile)) { watchdog('AMAT Migration', "nid $node->nid - Could not write to $tmpfile", NULL, WATCHDOG_ERROR); } elseif (!$file = field_file_save_file($tmpfile, array(), $pdfpath)) { watchdog('AMAT Migration', "nid $node->nid - Could not create file object for file $tmpfile", NULL, WATCHDOG_ERROR); } else { $fc = $file; $fid = $fc['fid']; $file = field_file_save($node, $file); $node->field_arms_pdffile = array( 0 => array( 'fid' => $fc['fid'], 'title' => basename($fc['filename']), 'filename' => $fc['filename'], 'filepath' => $fc['filepath'], 'filesize' => $fc['filesize'], 'mimetype' => $fc['filemime'], 'data' => array('description' => ''), 'list' => 1, ), ); node_save($node); } } // } break; } } }