Creates a temporary file, for a specific user.
string $data: A string containing the contents of the file.
int $uid: The user ID of the file owner.
object A file object, or FALSE on error.
function createTemporaryFile($data, $uid = NULL) {
$file = file_save_data($data, NULL, NULL);
if ($file) {
$file->uid = isset($uid) ? $uid : $this->admin_user->uid;
// Change the file status to be temporary.
$file->status = NULL;
return file_save($file);
}
return $file;
}