For uploading files, we're using a very popular package called Laravel Medialibrary, you can view its official documentation here.
You can read our in-depth tutorial: Multiple File Upload with Dropzone.js and Laravel MediaLibrary Package
As per Laravel Medialibrary functionality, the files are stored by default in storage/app/public folder, dividing every file in its own subfolder with ID number:
By default, storage/ internal folders are not available in the browser for public visitors, to change that - you need to run one important Artisan command:
php artisan storage:linkSee more info in the official Laravel documentation: The Public Disk
If you want to change the location of where files are stored, change your parameters in config/filesystems.php file:
'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], 's3' => [ 'driver' => 's3', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), 'url' => env('AWS_URL'), ], ], ];
In the database, filenames for all CRUDs are stores in one DB table media - this is how Laravel Medialibrary works.
This table uses Polymorphic Relations to tie the media record to the CRUD Model it belongs to - see columns model_type and model_id.