Skip to content

Commit

Permalink
ensure raw file exists in payload
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Sep 13, 2023
1 parent e22db1c commit 8def0dc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/apis/StorageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,9 @@ public function actionDataFilters()
public function actionFileReplace()
{
$fileId = Yii::$app->request->post('fileId', false);
$pageId = Yii::$app->request->post('pageId', 0);
Yii::warning('replace request for file id' . $fileId, __METHOD__);
$raw = $_FILES['file'];
$raw = $_FILES['file'] ?? false;
/** @var $file \luya\admin\file\Item */
if ($file = Yii::$app->storage->getFile($fileId)) {
if ($raw && $file = Yii::$app->storage->getFile($fileId)) {
$newFileSource = $raw['tmp_name'];
if (is_uploaded_file($newFileSource)) {
// check for same extension / mimeType
Expand Down

0 comments on commit 8def0dc

Please sign in to comment.