Step 1: Check the correct method chaining for upload
The upload method must be called on supabase.storage.from('bucket'), not directly on supabase.storage.
Step 2: Identify the missing part in the code
The code misses the .from('docs') call before .upload.
Final Answer:
Missing .from('docs') before .upload -> Option D
Quick Check:
Use .from('bucket') before upload [OK]
Hint: Always call .from('bucket') before .upload [OK]
Common Mistakes:
Calling upload directly on storage
Assuming upload returns no data
Ignoring file variable initialization
5. You want to upload multiple files securely to Supabase Storage and ensure each file is stored in a separate folder by user ID. Which approach best achieves this?
hard
A. Use one bucket and upload files to paths like 'userID/filename'
B. Create a bucket per user and upload files directly
C. Upload all files to root bucket folder and rename later
D. Upload files without folders and rely on metadata
Solution
Step 1: Consider bucket management best practices
Creating a bucket per user is inefficient and can complicate access control.
Step 2: Use folder paths inside a single bucket
Uploading files to paths like 'userID/filename' inside one bucket organizes files logically and keeps access control manageable.
Step 3: Avoid root uploads or relying only on metadata
Uploading all files to root or relying on metadata makes file management and security harder.
Final Answer:
Use one bucket and upload files to paths like 'userID/filename' -> Option A
Quick Check:
Organize by folder path inside bucket [OK]
Hint: Use folder paths with userID inside one bucket [OK]
Common Mistakes:
Creating too many buckets
Uploading all files to root folder
Ignoring folder structure for security
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.