Topic 13 / 40
File Upload Processing & Media Storage
1. Deep Architecture
Django handles file uploads using upload handlers. Small files are stored in memory (MemoryUploadedFile). Files larger than 2.5MB are streamed to a temporary directory on disk (TemporaryUploadedFile). Media uploads should be stored on external object storage (like AWS S3) rather than the web server.
2. The Feynman Gatekeeper
[KNOWLEDGE CHECK] What is the difference between MemoryUploadedFile and TemporaryUploadedFile? How does file size change how uploads are handled?
3. The Code
# config/settings.py
# Example setting to direct file uploads to AWS S3 storage
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
AWS_STORAGE_BUCKET_NAME = 'sanjaya-raw-videos'
4. The Funnel
Stat Level-Up: File Marshall (Lvl 1).
Sanjaya Integration: Stream large creator video files safely to secure S3 storage bucket targets.