Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.170 diff -u -r1.170 file.inc --- includes/file.inc 2 Jun 2009 13:42:40 -0000 1.170 +++ includes/file.inc 6 Jun 2009 11:04:47 -0000 @@ -331,7 +331,7 @@ function file_save($file) { $file = (object)$file; $file->timestamp = REQUEST_TIME; - $file->filesize = filesize($file->filepath); + $file->filesize = filesize(file_create_path($file->filepath)); if (empty($file->fid)) { drupal_write_record('files', $file); @@ -985,8 +985,8 @@ // Move uploaded files from PHP's upload_tmp_dir to Drupal's temporary // directory. This overcomes open_basedir restrictions for future file // operations. - $file->filepath = $file->destination; - if (!move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->filepath)) { + $file->filepath = str_replace(file_directory_path() . '/', '', $file->destination); + if (!move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->destination)) { form_set_error($source, t('File upload error. Could not move uploaded file.')); watchdog('file', 'Upload error. Could not move uploaded file %file to destination %destination.', array('%file' => $file->filename, '%destination' => $file->filepath)); return FALSE;