Skip to content

Commit

Permalink
Update FileUploadBehavior.php
Browse files Browse the repository at this point in the history
  • Loading branch information
fgh151 authored May 18, 2021
1 parent 0574f79 commit 3fe69b2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions FileUploadBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ public function upload()
$path = \Yii::getAlias($path);

FileHelper::createDirectory($path);

$fileName = $file->baseName . '.' . $file->extension;

$fileName = $file->baseName;
if ($file->extension) {
$fileName += '.' . $file->extension;
}

$file->saveAs($path . '/' . $fileName);
$upload = new Upload();
$upload->fsFileName = $fileName;
Expand All @@ -76,4 +80,4 @@ public function upload()
}
}

}
}

0 comments on commit 3fe69b2

Please sign in to comment.