Laravel 5.3 sym link for storage

How to create symlink for storage if that needs to be done through controller.

I tried Artisan::call(‘storage:link’); in my controller it creates a symlink in public folder for storage but gives an error “Can’t change directory to storage: No such file or directory”

App::make('files')->link(storage_path('app/public'), public_path('storage'));

And don’t forget to use App
after namespace.

Another example like as to create the symbolic link, you may use the storage:link
Artisan command:

php artisan storage:link

Of course, once a file has been stored and the symbolic link has been created, you can create a URL to the files using the asset helper:

echo asset('storage/file.txt');
Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » Laravel 5.3 sym link for storage

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录