Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: mime_content_type error in csv reader #2061

Closed
Besmer opened this issue May 4, 2021 · 1 comment
Closed

Error: mime_content_type error in csv reader #2061

Besmer opened this issue May 4, 2021 · 1 comment

Comments

@Besmer
Copy link

Besmer commented May 4, 2021

This is:

- [*] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

Creating csv reader

What is the current behavior?

mime_content_type(): Argument #2 must be of type resource|string, Illuminate\Http\UploadedFile given

What are the steps to reproduce?

<?php

require __DIR__ . '/vendor/autoload.php';

$file = $request->file('spreadsheet');
$reader = IOFactory::createReaderForFile($file->getRealPath());

Which versions of PhpSpreadsheet and PHP are affected?

8.0.5

@Besmer Besmer closed this as completed May 4, 2021
@Besmer
Copy link
Author

Besmer commented May 4, 2021

I am idiot)
I am create file via path string, but trying to load object

<?php

require __DIR__ . '/vendor/autoload.php';

$file = $request->file('spreadsheet');
$reader = IOFactory::createReaderForFile($file->getRealPath());
$reader->setReadDataOnly(true);
$reader->setReadEmptyCells(false);
$reader->load($file);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant