Skip to main content

File Storage

Upload files as part of your documents and user profiles with automatic S3 storage integration. Files are uploaded alongside your data and their URLs are automatically stored in your documents.
Cocobase integrates file uploads directly into document and user operations. Files are automatically uploaded to S3 storage and their URLs are saved in your documents.

Overview

File storage features:
  • Integrated uploads - Upload files with document creation/updates
  • Multiple file types - Images, documents, videos, any file type
  • Single or array - Upload single files or arrays of files
  • Automatic URLs - File URLs automatically saved in documents
  • S3 storage - Secure, scalable cloud storage
  • User profile files - Upload avatars and cover photos with registration

Upload Files with Documents

Upload files when creating or updating documents using field naming.

Single File Upload

Response Structure:

Multiple Files (Array)

Upload multiple files to create an array of URLs:
Response:

Update Documents with Files

Update existing documents with new files:

User Registration with Files

Register users with profile pictures:
Response:

Update User Profile with Files

Update authenticated user’s profile pictures:

React Example

Complete React component with file uploads:

Create products with multiple images:

Best Practices

Always validate file types and sizes before uploading:
Provide visual feedback during uploads:
Reduce file sizes before uploading:
Let users preview images before uploading:
Provide meaningful error messages:

Field Naming Convention

Use descriptive field names for your files:

File Limits


Common Use Cases

User Avatars

Product Images

Document Uploads

Blog Post Media


Next Steps

CRUD Operations

Learn about creating and updating documents

Authentication

User authentication with profile pictures

Data Types

Understanding data structures

Best Practices

Tips for optimal file handling