To move file we need to have file object. We can get it using file_load(fid) function wich need file id as argumnet
$file = file_load(fid); if(isset($file)){ $date = date('d-m-Y'); //here we get any node we need $node = node_load(1); //here we actually move file @$file = file_move($file, 'public://webform/' . $date . '/' . $node->nid, $replace = FILE_EXISTS_RENAME); // here we can add this file already moved to any node field with type file if(!empty($file)){ $node->field_file_downloads = array("und" => array(0 => array("value" => $file->uri))); node_save($node); } }