Soumik Chakraborty
Soumik Chakraborty

Reputation: 253

How to create symlink for storage public folder for Lumen

I have used the following command to create symnlink for storage public folder for my project which I'm doing in Lumen . => php artisan storage:link

But I am getting this error in terminal =>

There are no commands defined in the "storage" namespace.

Another query is though I'm able to upload file in storage folder , how I'm able to access, I need some sample code for this. Kindly help.

Upvotes: 11

Views: 14218

Answers (6)

VPZ
VPZ

Reputation: 738

If you are on Windows, running below command in a Lumen project folder simply helps:

mklink /J public\storage storage\app\public

It does not require any Administrator privileges.

Upvotes: 3

Kamlesh
Kamlesh

Reputation: 6145

I am using Lumen 8.0 on Mac and Linux machine. I did not find any solution for lumen but we can create symbolic link by using full/complete path in command line:

ln -s /var/www/storage/app /var/www/public/storage

Upvotes: 2

Jaydeep Mor
Jaydeep Mor

Reputation: 1703

This is for windows,

First of all run cmd with administrator if you are on another user not in admin and then go to your project's public path e.g. project/path/public.

Then run below command,

mklink /D "storage\" "E:absolute/static/path~/storage/app/public/"

For e.g.,

mklink /D "storage\" "E:/User Name/Work/My Projects/storage/app/public/"

Hopefully it will help for Lumen windows users.

Upvotes: 6

Nisar Ahmed
Nisar Ahmed

Reputation: 331

More simple and short way using unix command :

Go to the lumen/public folder in the terminal or via ssh etc.

Run :

ln -s ../storage/app/public storage

Upvotes: 5

etihadsep
etihadsep

Reputation: 23

Lumen's artisan doesn't support "storage", that's why you got an error. Try to upload your file to app/public folder instead.

Change your upload path to app/public, too.

Upvotes: 0

Soumik Chakraborty
Soumik Chakraborty

Reputation: 253

I created by this unix command :

ln -s sourceforwhich symnlinkfolderpath e.g.:

ln -s /data/html/projectfolder/storage/app/public /data/html/projectfolder/public/storage

Upvotes: 10

Related Questions