Django: Getting Started Transcripts
Chapter: Receiving Uploads in Django
Lecture: Server-side filenames

Login or purchase this course to watch this video and the rest of the course contents.
0:00 The concept of the Django admin is you're trusting the people using it because their administrators. When you write your own upload pages,
0:09 you don't have to name the file you create on the user's behalf, whatever it was, the user named it. This is a good thing.
0:16 Typically if you let random people on the internet name things, it can result in strange choices. Google Boaty McBoatface if you don't believe me.
0:24 One way of managing the file overriding problem is to make sure that either the file
0:29 name or the directory the file is in on the server has something in it that is unique to the user. I often use the users ID.
0:37 Their numeric ID, not the user name. That way you can support a user choosing a new user name without having complications.
0:46 The next step is to write a view that allows the uploading of binary data, like image files. This is done using an http post method like all forms.
0:55 It just requires a special HTML form field. The upload view is then responsible for taking the binary data out of the form field
1:04 and writing it to the server. Typically, somewhere under the media route you specified in

Talk Python's Mastodon Michael Kennedy's Mastodon