Skip to content

Commit

Permalink
Update UploadAction.php
Browse files Browse the repository at this point in the history
To upload action added post parameter validation
  • Loading branch information
uldisn authored Mar 19, 2024
1 parent 583a61c commit 60ac871
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/UploadAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public function run(int $id): array
$d3filesModule = Yii::$app->getModule('d3files');

if (!$d3filesModule->disableController) {
if (!$postModelName) {
throw new HttpException(422, 'Can not upload file');
}
if (is_array($this->modelName) && !in_array($postModelName, $this->modelName, true)) {
throw new HttpException(422, 'Can not upload file for requested model');
}
Expand Down

0 comments on commit 60ac871

Please sign in to comment.