Skip to content

Commit

Permalink
Update File.php
Browse files Browse the repository at this point in the history
New file name is now used when moving a file
  • Loading branch information
Zheness authored Aug 1, 2018
1 parent 1bcbe0d commit ff80451
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Mouf/Html/Widgets/JqueryFileUpload/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function rename($newFileName, $mode = RenameEnum::MOVE) {
if ($mode === RenameEnum::MOVE_AND_RENAME) {
$targetFileName = $this->getTargetName($this->directory, $newFileName);
} else {
$targetFileName = $this->fileName;
$targetFileName = $newFileName;
}

$fs->rename($this->directory.'/'.$this->fileName, $this->directory.'/'.$targetFileName, $mode === RenameEnum::MOVE_AND_OVERWRITE);
Expand All @@ -109,7 +109,7 @@ public function moveAndRename($targetDir, $newFileName, $mode = RenameEnum::MOVE
if ($mode === RenameEnum::MOVE_AND_RENAME) {
$targetFileName = $this->getTargetName($targetDir, $newFileName);
} else {
$targetFileName = $this->fileName;
$targetFileName = $newFileName;
}

$fs->rename($this->directory.'/'.$this->fileName, $targetDir.'/'.$targetFileName, $mode === RenameEnum::MOVE_AND_OVERWRITE);
Expand Down

0 comments on commit ff80451

Please sign in to comment.