Django File Upload
by Vitor Freitas
1. Basic Concepts
1.1. Send file using POST request
1.2. Set proper form encode type
1.2.1. enctype="multipart/form-data"
1.3. Files are uploaded to request.FILES
1.3.1. Dictionary-like object
1.3.2. Each file is an UploadedFile instance
2. Configuration
2.1. MEDIA_ROOT
2.2. MEDIA_URL
2.3. Serving media files on local machine
3. Handling Uploaded Files
3.1. File storage API - FileSystemStorage
3.2. Model form fields FileField and ImageField
3.2.1. FileField
3.2.1.1. File saved in the file system
3.2.1.2. Saved as text in the database
3.2.1.3. File is not deleted if object is deleted
3.2.1.4. Override model delete method
3.2.2. ImageField
3.2.2.1. Pillow — Pillow (PIL Fork) 5.3.0 documentation