I created a custom content type called "resume" which contains a number of fields (using CCK). One field is a CCK FileField (6.x-3.5). Normally, when I create a resume node, I can select the path + filename (on my local machine) for the file to upload, and the upload occurs when the node is saved. No problem there.

Now, I wrote a module with a function resume_create() that programmatically creates a resume node. How do I insert the path + filename information from the remote machine into the $form_state variable? When resume_create() is called, I plan to pass in the file path information (from the user's machine), which is obtained elsewhere in a previous step.

function resume_create($resume = array()) {

  //print "Creating Resume Node.";

  // include node file, necessary for node generation
  module_load_include('inc', 'node', 'node.pages');

  $form_state = array();
  $form_state['values'] = array(
    'title' => t('DummyTitle'),
    'body' => t(''),
    'name' => 'admin', 
    'op' => t('Save'),
    'status' => 1,
  );

  // create $node
  //$node = (object) NULL;
  //$node->type = 'resume';
  $node = array('type' => 'resume');

  // Add CCK fields
  $form_state['values']['field_firstname'][0]['value'] = $resume['first'];
  $form_state['values']['field_lastname'][0]['value'] = $resume['last'];
  $form_state['values']['field_email'][0]['email'] = $resume['email'];
  // How do I insert the file path info from the user's machine into the $form_state array?

  node_get_types('types', NULL, TRUE);

  // create node using drupal_execute
  drupal_execute('resume_node_form', $form_state, (object) $node);

  //print "Resume created!!!";
}

Thanks for any help.