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

No ReaderType or WriterType could be detected #2201

Closed
Tushar0012 opened this issue May 20, 2019 · 23 comments
Closed

No ReaderType or WriterType could be detected #2201

Tushar0012 opened this issue May 20, 2019 · 23 comments

Comments

@Tushar0012
Copy link

I am getting this issue on excel file import on web server. But this is working fine on local server.

Maatwebsite \ Excel \ Exceptions \ NoTypeDetectedException
No ReaderType or WriterType could be detected. Make sure you either pass a valid extension to the filename or pass an explicit type.

Please help to resolve this issue.

@ghost
Copy link

ghost commented May 20, 2019

Thanks for submitting the ticket. Unfortunately the information you provided is incomplete. We need to know which version you use and how to reproduce it. Please include code examples. Before we can pick it up, please check (https://github.com/Maatwebsite/Laravel-Excel/blob/3.1/.github/ISSUE_TEMPLATE.md) and add the missing information. To make processing of this ticket a lot easier, please make sure to check (https://laravel-excel.maatwebsite.nl/3.1/getting-started/contributing.html) and double-check if you have filled in the issue template correctly. This will allow us to pick up your ticket more efficiently. Issues that follow the guidelines correctly will get priority over other issues.

@patrickbrouwers
Copy link
Member

I think the exception message is pretty clear. Make sure that it has an extension, or be explicit and pass a writer/reader type.

@Tushar0012
Copy link
Author

Error has resolved. I was sending a wrong file path to import.
Thank you for being help.

@GlennM
Copy link
Contributor

GlennM commented May 22, 2019

Glad to hear your issue has been resolved. Thank you for using Laravel Excel!

@GlennM GlennM closed this as completed May 22, 2019
@mindnotix-vc
Copy link

Error has resolved. I was sending a wrong file path to import.
Thank you for being help.

Same error i am also facing, can you tell where you have mention the file path. since i am using getRealPath() to get the upload file and directly using the Excel::import

@mindnotix-vc
Copy link

Error has resolved. I was sending a wrong file path to import.
Thank you for being help.

Same error i am also facing, can you tell where you have mention the file path. since i am using getRealPath() to get the upload file and directly using the Excel::import

Thanks.. i solved the issue, by the same way you mention

@himalayadhanera
Copy link

himalayadhanera commented Jul 7, 2019

can anyone help me out with this issue `No ReaderType or WriterType could be detected. Make sure you either pass a valid extension to the filename or pass an explicit type.
' im getting this error after doing deployment on heroku

@GlennM
Copy link
Contributor

GlennM commented Jul 8, 2019

can anyone help me out with this issue `No ReaderType or WriterType could be detected. Make sure you either pass a valid extension to the filename or pass an explicit type.
' im getting this error after doing deployment on heroku

Please create a new ticket with the issue template filled. The issue template is required for us to be able to help you and is automatically available for you when opening a new issue, please do not remove the contents of the issue template.

@Hurmatullah
Copy link

can anyone help me how to upload utf-8 csv file . i am facing with like this error : Maatwebsite \ Excel \ Exceptions \ NoTypeDetectedException
No ReaderType or WriterType could be detected. Make sure you either pass a valid extension to the filename or pass an explicit type.

@HemantoPaul
Copy link

Same error i am also facing, can you tell where you have mention the file path. since i am using getRealPath() to get the upload file and directly using the Excel::import

@patrickbrouwers
Copy link
Member

That won’t work, real path doesn’t have an extension so we can’t guess the reader type. Pass the uploaded file instance or the reader type explicitly

@RafaDeMarcoo
Copy link

The issue is the getRealPath()
I found the solution in here:

https://stackoverflow.com/a/57106453/12226621

instead of
$path = $request->file('mcafile')->getRealPath();

store it into a temp , get that path, and send it to the import function

$path1 = $request->file('mcafile')->store('temp'); 
$path=storage_path('app').'/'.$path1;  
$data = \Excel::import(new UsersImport,$path);

@patrickbrouwers
Copy link
Member

You can just pass the uploaded file: \Excel::import(new UsersImport, $request->file('mcafile'))

@technoknol
Copy link

If you are on Cent OS, it stores temp file without extension. So just rename a temp file and add a tmp extension.

My code like below is working :

$tmpfname = request()->file('userfile')->getPathName();
rename($tmpfname, $tmpfname .= '.tmp');

@edocollado
Copy link

As a complement:

If nothing works. You should verify your HTML form enctype attribute

like that: enctype="multipart/form-data"

or

like that: <form action="/action" method="post" enctype="multipart/form-data">

you have to include this enctype or it will cause the following error:

No ReaderType or WriterType could be detected. Make sure you either pass a valid extension to the filename or pass an explicit type

@besstilahun

This comment has been minimized.

@besstilahun

This comment has been minimized.

@fachrisdakbar
Copy link

Error has resolved. I was sending a wrong file path to import.
Thank you for being help.

can you share here. what you have done?

@joe94113
Copy link

@edocollado thanks,I'm careless

@aryoppa
Copy link

aryoppa commented Jan 19, 2023

Error has resolved. I was sending a wrong file path to import. Thank you for being help.

could you share your code please? i have a same problem and couldnt find the answe yet :(

@SanketDawange
Copy link

As a complement:

If nothing works. You should verify your HTML form enctype attribute

like that: enctype="multipart/form-data"

or

like that: <form action="/action" method="post" enctype="multipart/form-data">

you have to include this enctype or it will cause the following error:

No ReaderType or WriterType could be detected. Make sure you either pass a valid extension to the filename or pass an explicit type

It worked for me

@ejlocop
Copy link

ejlocop commented Sep 22, 2023

If you are on Cent OS, it stores temp file without extension. So just rename a temp file and add a tmp extension.

My code like below is working :

$tmpfname = request()->file('userfile')->getPathName();
rename($tmpfname, $tmpfname .= '.tmp');

this worked for me, thanks.

@SanketDawange
Copy link

SanketDawange commented Sep 22, 2023 via email

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

No branches or pull requests