Closed
Description
This is:
- [] a bug report
- [x] a feature request
- [x] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
Able to stream a file to an Amazon S3 bucket using the writer object
What is the current behavior?
It currently fails on the line below in \PhpOffice\PhpSpreadsheet\Writer\BaseWriter because Amazon S3 buckets don't support fopen in wb+ mode (see Amazon S3 docs).
<?php
$fileHandle = $filename ? fopen($filename, 'wb+') : false;
The error thrown is from Amazon S3 is:
Mode not supported: wb+. Use one 'r', 'w', 'a', or 'x'.
Using wb mode instead works but I don't have a detailed enough understanding of PhpSpreadsheet to be sure that it wouldn't break anything else.
What are the steps to reproduce?
Create an spreadsheet object and attempt to wrote to an Amazon S3 bucket using the writer object.
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
<?php
require __DIR__ . '/vendor/autoload.php';
// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$spreadsheet->getActiveSheet()->setCellValue('Test');
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
$write->save('s3://mybucket/myfile.xlsx');
Which versions of PhpSpreadsheet and PHP are affected?
I'm using PHP 7.3.4 and PHPSpreadsheet 1.18.0
Metadata
Metadata
Assignees
Labels
No labels