# File Storage (Laravel) > การกำหนดค่า filesystem, ดิสก์ในเครื่อง, S3, การอัปโหลดไฟล์, การจัดการไฟล์, การมองเห็น, symbolic link, streaming - 18 คำถามสัมภาษณ์ - Mid-Level - [คำถามสัมภาษณ์: Laravel](https://sharpskill.dev/th/technologies/laravel/interview-questions.md) ## 1. ไฟล์การกำหนดค่าของ Laravel ใดที่กำหนด disk สำหรับจัดเก็บไฟล์? **คำตอบ** ไฟล์ config/filesystems.php รวมศูนย์การกำหนดค่าระบบจัดเก็บข้อมูลทั้งหมดใน Laravel โดยกำหนด disk ที่ใช้ได้ (local, public, s3), driver ของแต่ละตัว และพารามิเตอร์เฉพาะ เช่น ไดเรกทอรีราก, การมองเห็นเริ่มต้น หรือข้อมูลรับรอง cloud การรวมศูนย์นี้ช่วยให้สลับระหว่าง backend จัดเก็บข้อมูลต่าง ๆ ได้ง่ายโดยไม่ต้องแก้ไขโค้ดเชิงธุรกิจ ## 2. เมธอดใดที่ช่วยให้จัดเก็บเนื้อหาลงในไฟล์โดยตรงด้วย Laravel Storage? **คำตอบ** เมธอด Storage::put() รับ path และเนื้อหา (string หรือ resource) เพื่อสร้างหรือเขียนทับไฟล์ โดยจะคืนค่า boolean ที่บอกว่าการดำเนินการสำเร็จหรือไม่ เมธอดนี้เหมาะอย่างยิ่งสำหรับจัดเก็บเนื้อหาที่สร้างขึ้นแบบไดนามิก เช่น export CSV, รายงาน JSON หรือเนื้อหาที่ดาวน์โหลดผ่าน API สำหรับการอัปโหลดฟอร์มด้วย UploadedFile นั้น putFile() หรือ putFileAs() เหมาะสมกว่า ## 3. disk ของ Laravel ใดที่จัดเก็บไฟล์ที่เข้าถึงได้แบบสาธารณะผ่าน URL? **คำตอบ** disk public จัดเก็บไฟล์ไว้ใน storage/app/public และใช้ symbolic link ไปยัง public/storage เพื่อให้เข้าถึงได้ผ่าน HTTP คำสั่ง php artisan storage:link จะสร้าง symbolic link นี้ disk นี้ถูกกำหนดค่า visibility เป็น public โดยค่าเริ่มต้น ทำให้เข้าถึงไฟล์ได้โดยตรงผ่าน URL เช่น /storage/avatars/user.jpg เหมาะสำหรับ asset ของผู้ใช้ เช่น avatar, รูปโปรไฟล์ หรือเอกสารสาธารณะ ## มีอีก 15 คำถาม - เมธอดใดที่ตรวจสอบว่าไฟล์มีอยู่ในระบบจัดเก็บข้อมูลหรือไม่? - คำสั่ง Artisan ใดที่สร้าง symbolic link สำหรับ disk public? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ Laravel อื่นๆ - [พื้นฐาน PHP](https://sharpskill.dev/th/technologies/laravel/interview-questions/php-basics.md): 25 คำถาม, Junior - [พื้นฐาน OOP ใน PHP](https://sharpskill.dev/th/technologies/laravel/interview-questions/php-oop-essentials.md): 20 คำถาม, Junior - [Composer & Autoloading](https://sharpskill.dev/th/technologies/laravel/interview-questions/composer-autoloading.md): 18 คำถาม, Junior - [พื้นฐาน Laravel](https://sharpskill.dev/th/technologies/laravel/interview-questions/laravel-fundamentals.md): 20 คำถาม, Junior - [Laravel Routing](https://sharpskill.dev/th/technologies/laravel/interview-questions/laravel-routing.md): 20 คำถาม, Junior - [Blade Templates](https://sharpskill.dev/th/technologies/laravel/interview-questions/blade-templates.md): 18 คำถาม, Junior - [Request & Response](https://sharpskill.dev/th/technologies/laravel/interview-questions/request-response.md): 20 คำถาม, Junior - [พื้นฐาน Eloquent ORM](https://sharpskill.dev/th/technologies/laravel/interview-questions/eloquent-orm-basics.md): 22 คำถาม, Junior - [Eloquent Relationships](https://sharpskill.dev/th/technologies/laravel/interview-questions/eloquent-relationships.md): 25 คำถาม, Mid-Level - [Migrations & Schema Builder](https://sharpskill.dev/th/technologies/laravel/interview-questions/database-migrations.md): 20 คำถาม, Mid-Level - [การตรวจสอบและฟอร์ม](https://sharpskill.dev/th/technologies/laravel/interview-questions/validation-forms.md): 22 คำถาม, Mid-Level - [การยืนยันตัวตน](https://sharpskill.dev/th/technologies/laravel/interview-questions/authentication.md): 20 คำถาม, Mid-Level - [การให้สิทธิ์และ Policies](https://sharpskill.dev/th/technologies/laravel/interview-questions/authorization-policies.md): 18 คำถาม, Mid-Level - [API Resources & Authentication](https://sharpskill.dev/th/technologies/laravel/interview-questions/api-resources-authentication.md): 26 คำถาม, Mid-Level - [Middleware](https://sharpskill.dev/th/technologies/laravel/interview-questions/middleware.md): 18 คำถาม, Mid-Level - [Service Container & DI](https://sharpskill.dev/th/technologies/laravel/interview-questions/service-container-di.md): 20 คำถาม, Mid-Level - [Queues & Jobs](https://sharpskill.dev/th/technologies/laravel/interview-questions/queues-jobs.md): 22 คำถาม, Mid-Level - [Events & Listeners](https://sharpskill.dev/th/technologies/laravel/interview-questions/events-listeners.md): 18 คำถาม, Mid-Level - [การแจ้งเตือนและเมล](https://sharpskill.dev/th/technologies/laravel/interview-questions/notifications-mail.md): 20 คำถาม, Mid-Level - [Testing & PHPUnit](https://sharpskill.dev/th/technologies/laravel/interview-questions/testing-phpunit.md): 24 คำถาม, Mid-Level - [Caching](https://sharpskill.dev/th/technologies/laravel/interview-questions/caching.md): 18 คำถาม, Mid-Level - [Livewire & Inertia](https://sharpskill.dev/th/technologies/laravel/interview-questions/livewire-inertia.md): 20 คำถาม, Mid-Level - [Eloquent Advanced](https://sharpskill.dev/th/technologies/laravel/interview-questions/eloquent-advanced.md): 24 คำถาม, Senior - [Repository Pattern](https://sharpskill.dev/th/technologies/laravel/interview-questions/repository-pattern.md): 20 คำถาม, Senior - [Laravel Packages](https://sharpskill.dev/th/technologies/laravel/interview-questions/laravel-packages.md): 20 คำถาม, Senior - [Performance Optimization](https://sharpskill.dev/th/technologies/laravel/interview-questions/performance-optimization.md): 22 คำถาม, Senior - [Security Best Practices](https://sharpskill.dev/th/technologies/laravel/interview-questions/security-best-practices.md): 22 คำถาม, Senior - [Laravel Octane](https://sharpskill.dev/th/technologies/laravel/interview-questions/laravel-octane.md): 18 คำถาม, Senior - [Laravel Distributed Systems](https://sharpskill.dev/th/technologies/laravel/interview-questions/laravel-distributed-systems.md): 22 คำถาม, Senior - [Observability & Monitoring](https://sharpskill.dev/th/technologies/laravel/interview-questions/observability-monitoring.md): 20 คำถาม, Senior - [Deployment & DevOps](https://sharpskill.dev/th/technologies/laravel/interview-questions/deployment-devops.md): 20 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/laravel/interview-questions/file-storage