laravel_ninja's avatar

Laravel File Storage Concept

In Laravel while using public driver for file storage why we need to create symbolic link from public/storage to storage/app/public

0 likes
2 replies
jlrdw's avatar

It's just a folder pre picked to store files (non sucure however). You can store files any where you want. You do understand how symbolic links work, right? As a pointer to that folder.

1 like
tisuchi's avatar
tisuchi
Best Answer
Level 70

@laravel_ninja In Laravel, the public disk is intended to be used for files that will be publicly accessible, while preserving the safety and integrity of the core application. The use of symbolic links is a strategy to achieve this goal without compromising on the architecture.

To sum up, the symbolic link from public/storage to storage/app/public allows you to:

  • Keep user-generated, publicly accessible files separate from the core application.
  • Make these files accessible from the web while keeping the rest of the storage directory safe.
  • Maintain a clean structure that's conducive for deployment and versioning.
2 likes

Please or to participate in this conversation.