form_set_error($source,t('File upload error. Could not move uploaded file.'));
watchdog('file','Upload error. Could not move file %file to destination %destination.',array('%file'=>$file->filename,'%destination'=>$file->filepath));
return0;
}
// If we made it this far it's safe to record this file in the database.
$file->uid=$user->uid;
$file->status=FILE_STATUS_TEMPORARY;
$file->timestamp=time();
drupal_write_record('files',$file);
// Let modules add additional properties to the yet barebone file object.