Skip to content

Commit

Permalink
Fix #308: Fix yii\mongodb\file\Upload::addFile() error when uploadi…
Browse files Browse the repository at this point in the history
…ng file with readonly permissions
  • Loading branch information
sparchatus authored Apr 20, 2020
1 parent 837c14c commit b453773
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Yii Framework 2 mongodb extension Change Log
2.1.10 under development
------------------------

- no changes in this release.
- Bug #308: Fix `yii\mongodb\file\Upload::addFile()` error when uploading file with readonly permissions (sparchatus)


2.1.9 November 19, 2019
Expand Down
4 changes: 2 additions & 2 deletions src/file/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function addFile($filename)
$this->filename = basename($filename);
}

$stream = fopen($filename, 'r+');
$stream = fopen($filename, 'r');
if ($stream === false) {
throw new InvalidParamException("Unable to read file '{$filename}'");
}
Expand Down Expand Up @@ -277,4 +277,4 @@ private function insertFile()
$this->collection->insert($fileDocument);
return $fileDocument;
}
}
}

0 comments on commit b453773

Please sign in to comment.