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.
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.
I think the exception message is pretty clear. Make sure that it has an extension, or be explicit and pass a writer/reader type.
Error has resolved. I was sending a wrong file path to import.
Thank you for being help.
Glad to hear your issue has been resolved. Thank you for using Laravel Excel!
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
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
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
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.
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.
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
That won鈥檛 work, real path doesn鈥檛 have an extension so we can鈥檛 guess the reader type. Pass the uploaded file instance or the reader type explicitly
The issue is the getRealPath()
I found the solution in here:
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);
You can just pass the uploaded file: \Excel::import(new UsersImport, $request->file('mcafile'))
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');
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
Maatwebsite\Excel\Exceptions\NoTypeDetectedException
this is my controller:
{
Excel::import(new MedicineImport(Auth::user()->id), request()->file('select_file'));
return redirect('subscriber/medicine/imp')->with('success', 'All good!');
}
and this is my form:
<form method="get" enctype="multipart/form-data" action="{{ url('subscriber/medicine/imp/impEx') }}">
{{ csrf_field() }}
<label>Select File for Upload</label>
<input type="file" name="select_file" />
<input type="submit" name="upload" class="btn btn-primary" value="Upload">
</form>
please tell me why it's showing this error and am using 3.1
Hellow, i have an issue here on the above! i need your assist please.
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?
Most helpful comment
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