Skip to content

Commit

Permalink
[FEATURE] Ability to stream to an Amazon S3 bucket (#2326)
Browse files Browse the repository at this point in the history
Related #2249
  • Loading branch information
ayacoo authored Oct 16, 2021
1 parent 86a8bbd commit 1f08f16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org).
- More flexibility in the StringValueBinder to determine what datatypes should be treated as strings [PR #2138](https://github.com/PHPOffice/PhpSpreadsheet/pull/2138)
- Helper class for conversion between css size Units of measure (`px`, `pt`, `pc`, `in`, `cm`, `mm`). [PR #2152](https://github.com/PHPOffice/PhpSpreadsheet/issues/2145)
- Allow Row height and Column Width to be set using different units of measure (`px`, `pt`, `pc`, `in`, `cm`, `mm`), rather than only in points or MS Excel column width units. [PR #2152](https://github.com/PHPOffice/PhpSpreadsheet/issues/2145)
- Ability to stream to an Amazon S3 bucket
[Issue #2249](https://github.com/PHPOffice/PhpSpreadsheet/issues/2249)

### Changed

Expand Down
7 changes: 6 additions & 1 deletion src/PhpSpreadsheet/Writer/BaseWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ public function openFileHandle($filename): void
return;
}

$fileHandle = $filename ? fopen($filename, 'wb+') : false;
$mode = 'wb+';
$scheme = parse_url($filename, PHP_URL_SCHEME);
if ($scheme === 's3') {
$mode = 'w';
}
$fileHandle = $filename ? fopen($filename, $mode) : false;
if ($fileHandle === false) {
throw new Exception('Could not open file "' . $filename . '" for writing.');
}
Expand Down

0 comments on commit 1f08f16

Please sign in to comment.