根据官方文档说明调用报错
LaravelUploadedFile::wrapper($request->file('avatar'))可成功返回对象
$path = LaravelUploadedFile::wrapper($request->file('avatar'))->store('avatars');
但是根据官方教程store时候就报错了
已经根据提示教程安装
composer.json
"webman-tech/laravel-filesystem": "^2.1",
"illuminate/filesystem": "^8.83",
"league/flysystem": "~1.1",
"webman-tech/polyfill": "^1.0",
"illuminate/http": "^8.83"
期待能正常执行
报错提示
#Webman\Exception\NotFoundException: Class 'Illuminate\Contracts\Filesystem\Factory' not found in /chancemall/webman/vendor/workerman/webman-framework/src/Container.php:36
#Stack trace:
#0 /chancemall/webman/vendor/workerman/webman-framework/src/support/Container.php(45): Webman\Container->get('Illuminate\\Cont...')
#1 /chancemall/webman/config/plugin/webman-tech/polyfill/app.php(14): support\Container::__callStatic('get', Array)
#2 [internal function]: Webman\Config::{closure}()
#3 /chancemall/webman/vendor/webman-tech/polyfill/src/Traits/LaravelComponentGetter.php(19): call_user_func(Object(Closure))
#4 /chancemall/webman/vendor/webman-tech/polyfill/src/LaravelUploadedFile.php(27): WebmanTech\Polyfill\LaravelUploadedFile->getLaravelComponent('filesystem', 'Illuminate\\Cont...')
#5 /chancemall/webman/vendor/illuminate/http/UploadedFile.php(36): WebmanTech\Polyfill\LaravelUploadedFile->storeAs('avatars', 'EpFGWSnB3QJkucR...', Array)
#6 /chancemall/webman/app/controller/FileController.php(39): Illuminate\Http\UploadedFile->store('avatars')
#7 /chancemall/webman/vendor/workerman/webman-framework/src/App.php(284): app\controller\FileController->create(Object(support\Request))
#8 /chancemall/webman/vendor/workerman/webman-framework/src/App.php(304): Webman\App::Webman\{closure}(Object(support\Request))
#9 /chancemall/webman/vendor/webman/cors/src/CORS.php(12): Webman\App::Webman\{closure}(Object(support\Request))
#10 /chancemall/webman/vendor/workerman/webman-framework/src/App.php(299): Webman\Cors\CORS->process(Object(support\Request), Object(Closure))
#11 /chancemall/webman/vendor/workerman/webman-framework/src/App.php(515): Webman\App::Webman\{closure}(Object(support\Request))
#12 /chancemall/webman/vendor/workerman/webman-framework/src/App.php(128): Webman\App::findRoute(Object(Workerman\Connection\TcpConnection), '/backend/files/...', 'POST/backend/fi...', Object(support\Request))
#13 /chancemall/webman/vendor/workerman/workerman/Connection/TcpConnection.php(638): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(support\Request))
#14 /chancemall/webman/vendor/workerman/workerman/Events/Select.php(311): Workerman\Connection\TcpConnection->baseRead(Resource id #254)
#15 /chancemall/webman/vendor/workerman/workerman/Worker.php(2457): Workerman\Events\Select->loop()
#16 /chancemall/webman/vendor/workerman/workerman/Worker.php(1568): Workerman\Worker->run()
#17 /chancemall/webman/vendor/workerman/workerman/Worker.php(1410): Workerman\Worker::forkOneWorkerForLinux(Object(Workerman\Worker))
#18 /chancemall/webman/vendor/workerman/workerman/Worker.php(1384): Workerman\Worker::forkWorkersForLinux()
#19 /chancemall/webman/vendor/workerman/workerman/Worker.php(559): Workerman\Worker::forkWorkers()
#20 /chancemall/webman/vendor/workerman/webman-framework/src/support/App.php(124): Workerman\Worker::runAll()
#21 /chancemall/webman/start.php(4): support\App::run()
#22 {main}
webman版本1.4.7
系统环境 macos
PHP版本7.4
已经解决
因为什么问题发出来,方便别人下次好解决.
作者回复的:https://github.com/webman-tech/laravel-filesystem/issues/1