i get the following error:
Class 'App\Http\Controllers\File' not found
when using in laravel 5 Controller:
$files = File::files( $this->csvDir );
I have to add the Filesystem to composer.json
and config/app.php
. Somehow I use a misconfiguration.
That's what I changed:
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "5.*",
"illuminate/filesystem": "5.*" /* my try to repo */
},
'providers' => [
// [...]
// jerik 2015-04-17: get html Forms
// http://laravel.io/forum/09-20-2014-html-form-class-not-found-in-laravel-5
'Illuminate\Html\HtmlServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider', // try to add file
When I run composer update
, it runs well, but there is no ouput that the Filesystem is downloaded. So my configuration is wrong, but I do not know the correct way.
Any suggestions or tips?
First you shoud consider using built-in Storage facade. You don't need to include manually Filesystem
unless you use S3 or Rackspace because it's already included by default - look at Filesystem in Laravel 5 documentation.
It also seems, that you should import File
so try
use File;
or \File
to solve the issue because now you are using File from current namespace and probably File
is not defined in App\Http\Controllers
namespace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With