Overview
QFieldCloud provides comprehensive file management capabilities with versioning, multiple storage backend support, and efficient file operations. The system handles both regular project files and packaged files for offline use.Storage Architecture
Storage Backends
QFieldCloud supports multiple storage backends configured in Django’sSTORAGES setting:
- S3 - Amazon S3 storage
- MinIO - Self-hosted S3-compatible storage
- Custom - Any Django storage backend
File Storage Configuration
Projects can specify storage backends:core/models.py:1262.
File Model
TheFile model represents a logical file within a project:
filestorage/models.py:41.
File Types
- PROJECT_FILE - Source files uploaded by users
- PACKAGE_FILE - Generated files for mobile download
File Versioning
FileVersion Model
Each file upload creates a new version:filestorage/models.py:283.
Storage Path Structure
File versions are stored with the following pattern:Regular Files
Attachment Files (Versioned)
Same as regular files whenare_attachments_versioned=True.
Attachment Files (Non-Versioned)
are_attachments_versioned=False - only latest version kept.
Package Files
filestorage/models.py:262.
Version Retention
Control how many versions to keep:- null - Use owner’s subscription plan default
- 1-100 - Keep specified number of versions (Premium feature)
- Older versions automatically purged
core/models.py:1241.
File Operations
Uploading Files
API Endpoint
Request
Multipart form data with file content:Upload Process
-
Validation
- Check user permissions
- Validate filename
- Check storage quota
-
Checksum Calculation
-
Version Creation
-
Storage Backend Upload
- Content uploaded to configured storage
- Metadata (checksums) stored with version
-
Post-Upload Actions
- Update project’s
data_last_updated_at - Trigger
ProcessProjectfileJobfor .qgs/.qgz files - Purge old versions if limit exceeded
- Update project’s
filestorage/models.py:158.
Downloading Files
List Files
Download Specific Version
Download Latest Version
Deleting Files
Attachment Files
Attachment Directory Configuration
Attachment directories are configured in project details:DCIM.
See core/models.py:1535.
Attachment Versioning
Configure versioning behavior:- Saves storage space
- Appropriate for photos and media
- Filenames include extensions
core/models.py:1319.
On-Demand Download
Reduce initial package size:- Attachments excluded from initial package
- QField fetches when viewing feature
- Reduces mobile storage requirements
core/models.py:1311.
Data Directories
Projects can define data directories for symbology and assets:- Always included in packages
- Hold SVG symbols, images, project plugins
- Not treated as attachments
core/models.py:1555.
Restricted Project Files
Limit who can modify QGIS project files:- Only managers and admins can upload .qgs/.qgz/.qgd files
- Prevents accidental project corruption
- Other collaborators can still upload data files
core/models.py:1206.
Storage Quota
Quota Calculation
- All project file versions (based on retention policy)
- Attachment files
- Package files excluded from quota
core/models.py:513.
Checking Available Quota
Checksums and Integrity
Checksum Types
Three checksums stored per version:- MD5 - Quick file comparison
- SHA256 - Cryptographic verification
- ETag - S3-compatible identifier
Verification
Clients use checksums to:- Avoid re-uploading unchanged files
- Verify download integrity
- Detect file corruption
Metadata Storage
Checksums stored:- In database (
FileVersionmodel) - In S3 object metadata (legacy storage)
File Permissions
Permissions checked before file operations:Read Files
- Project owner
- All collaborators (any role)
- Public project viewers
Upload Files
- Admin, Manager, Editor roles
- Managers/Admins only for restricted project files
Delete Files
- Admin, Manager roles
- Project owner
Legacy Storage Support
QFieldCloud maintains backward compatibility:- Uses S3 versioned buckets directly
- Being phased out
- Migration tools available
core/models.py:1587.
Best Practices
File Organization
- Use consistent naming - Avoid special characters
- Organize in directories - Group related files
- Leverage attachment dirs - Keep media separate
- Configure data dirs - Include necessary assets
Performance
- Optimize file sizes - Compress where appropriate
- Use appropriate formats - GeoPackage for vector data
- Enable on-demand attachments - For large media collections
- Monitor storage quota - Regularly review file usage
Version Control
- Set appropriate retention - Balance between history and cost
- Version attachments selectively - Often not needed for photos
- Document major changes - Use commit messages where available
- Clean up old versions - Manually remove if needed
Security
- Use restricted project files - Protect critical configurations
- Review collaborator permissions - Grant appropriate file access
- Monitor file uploads - Check for unexpected changes
- Verify checksums - Ensure file integrity
API Reference
List All Files
skip_metadata=1- Faster response without SHA256 checksums
Get File Metadata
Upload File
multipart/form-data
Download File
version={version_id}- Download specific version
Delete File
Related Resources
- Projects - Project configuration and settings
- Synchronization - Packaging and download workflow
- Storage - Storage backend configuration