Skip to content

Commit

Permalink
Don't use move_uploaded_file when the source is in PATH_UPLOADS. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tburry committed Apr 13, 2013
1 parent e731485 commit 237b733
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/core/class.upload.php
Expand Up @@ -219,7 +219,9 @@ public function SaveAs($Source, $Target) {
if (!file_exists(dirname($Target)))
mkdir(dirname($Target));

if (!move_uploaded_file($Source, $Target))
if (StringBeginsWith($Source, PATH_UPLOADS))
rename($Source, $Target);
elseif (!move_uploaded_file($Source, $Target))
throw new Exception(sprintf(T('Failed to move uploaded file to target destination (%s).'), $Target));
}
return $Parsed;
Expand Down

0 comments on commit 237b733

Please sign in to comment.