Save image to node via form API I am having trouble figuring out how to attach an uploaded image to a node in my form submit handler. I've been searching for a while now and nothing I've tried has worked. For instance:

$image = $form_state['storage']['image'];
unset($form_state['storage']['image']);
$image-&gt;status = FILE_STATUS_PERMANENT;
$file = file_save($image);
$node-&gt;field_image['und'][0] = $file;


does not work. 

Any help on this would be much appreciated. Thanks.
It's been a while since I've done this but this link should be a good start. File Load

Assuming $form_state['storage']['image'] is the image's fid, what you may want to do is. 

$image = $form_state['storage']['image'];
$file = file_load($image);

// Change status to permanent.
$file-&gt;status = FILE_STATUS_PERMANENT;

// Save.
file_save($file);

// add image back
$node-&gt;field_image['und'][0] = $image;


Depending on what your doing you may want to add the file to the usage table. Details here.
File Usage Add