Laravel

File Storage

Filesystem configuration, local disk, S3, file uploads, file operations, visibility, symbolic links, streaming

18 mülakat soruları·
Mid-Level
1

Which Laravel configuration file defines file storage disks?

Cevap

The config/filesystems.php file centralizes all storage system configuration in Laravel. It defines available disks (local, public, s3), their respective drivers, and specific parameters like root directory, default visibility, or cloud credentials. This centralization allows easy switching between different storage backends without modifying business logic code.

2

Which method allows storing content directly into a file with Laravel Storage?

Cevap

The Storage::put() method accepts a path and content (string or resource) to create or overwrite a file. It returns a boolean indicating operation success. This method is ideal for storing dynamically generated content like CSV exports, JSON reports, or content downloaded via API. For form uploads with UploadedFile, putFile() or putFileAs() are more appropriate.

3

Which Laravel disk stores files publicly accessible via URL?

Cevap

The public disk stores files in storage/app/public and uses a symbolic link to public/storage to make them accessible via HTTP. The php artisan storage:link command creates this symbolic link. This disk is configured with public visibility by default, allowing direct file access via URLs like /storage/avatars/user.jpg. It suits user assets like avatars, profile images, or public documents.

4

Which method checks if a file exists in the storage system?

5

Which Artisan command creates the symbolic link for the public disk?

+15 mülakat soruları

Bir sonraki mülakatın için Laravel'de uzmanlaş

Tüm sorulara, flashcards'a, teknik testlere, code review alıştırmalarına ve mülakat simülatörlerine eriş.

Ücretsiz başla