Skip to content

Commit b453773

Browse files
authored
Fix #308: Fix yii\mongodb\file\Upload::addFile() error when uploading file with readonly permissions
1 parent 837c14c commit b453773

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Yii Framework 2 mongodb extension Change Log
44
2.1.10 under development
55
------------------------
66

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

99

1010
2.1.9 November 19, 2019

src/file/Upload.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function addFile($filename)
178178
$this->filename = basename($filename);
179179
}
180180

181-
$stream = fopen($filename, 'r+');
181+
$stream = fopen($filename, 'r');
182182
if ($stream === false) {
183183
throw new InvalidParamException("Unable to read file '{$filename}'");
184184
}
@@ -277,4 +277,4 @@ private function insertFile()
277277
$this->collection->insert($fileDocument);
278278
return $fileDocument;
279279
}
280-
}
280+
}

0 commit comments

Comments
 (0)