[FEATURE] Ability to stream to an Amazon S3 bucket (#2326)

Related #2249
This commit is contained in:
ayacoo 2021-10-16 18:11:03 +02:00 committed by GitHub
parent 86a8bbdd63
commit 1f08f160ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -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) - 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) - 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) - 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 ### Changed

View File

@ -115,7 +115,12 @@ abstract class BaseWriter implements IWriter
return; 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) { if ($fileHandle === false) {
throw new Exception('Could not open file "' . $filename . '" for writing.'); throw new Exception('Could not open file "' . $filename . '" for writing.');
} }