summaryrefslogtreecommitdiff
path: root/includes/file.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/file.inc')
-rw-r--r--includes/file.inc6
1 files changed, 4 insertions, 2 deletions
diff --git a/includes/file.inc b/includes/file.inc
index 5c8d28e04..a7ba5fb7c 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -574,8 +574,10 @@ function file_save_upload($source, $validators = array(), $dest = FALSE, $replac
}
// If we made it this far it's safe to record this file in the database.
- db_query("INSERT INTO {files} (uid, filename, filepath, filemime, filesize, status, timestamp) VALUES (%d, '%s', '%s', '%s', %d, %d, %d)", $user->uid, $file->filename, $file->filepath, $file->filemime, $file->filesize, FILE_STATUS_TEMPORARY, time());
- $file->fid = db_last_insert_id('files', 'fid');
+ $file->uid = $user->uid;
+ $file->status = FILE_STATUS_TEMPORARY;
+ $file->timestamp = time();
+ drupal_write_record('files', $file);
// Add file to the cache.
$upload_cache[$source] = $file;