0
0
Laravelframework~10 mins

Why file management is common in Laravel - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to store an uploaded file in Laravel.

Laravel
$path = $request->file('avatar')->[1]('avatars');
Drag options to blanks, or click blank then click option'
Astore
Bupload
Csave
Dput
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'upload' instead of 'store' causes errors.
Trying to use 'save' which is not a Laravel file method.
2fill in blank
medium

Complete the code to get the file's original name in Laravel.

Laravel
$originalName = $request->file('document')->[1]();
Drag options to blanks, or click blank then click option'
AgetName
BgetOriginalName
CoriginalName
DgetClientOriginalName
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'getOriginalName' which does not exist.
Using 'getName' which returns nothing.
3fill in blank
hard

Fix the error in the code to delete a file from storage in Laravel.

Laravel
Storage::[1]('public/photos/image.jpg');
Drag options to blanks, or click blank then click option'
Aremove
Bdestroy
Cdelete
Derase
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'remove' which causes method not found error.
Using 'destroy' which is not a Storage method.
4fill in blank
hard

Fill both blanks to check if a file exists and then get its size in Laravel.

Laravel
if (Storage::[1]('files/report.pdf')) {
    $size = Storage::[2]('files/report.pdf');
}
Drag options to blanks, or click blank then click option'
Aexists
Bsize
Chas
Dlength
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'has' instead of 'exists'.
Using 'length' instead of 'size'.
5fill in blank
hard

Fill all three blanks to create a symbolic link from storage to public folder in Laravel.

Laravel
php artisan [1]:[2] --relative=[3]
Drag options to blanks, or click blank then click option'
Astorage
Blink
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'storage' instead of 'link' as the artisan command.
Setting '--relative' to 'false' when relative link is needed.