Django: Getting Started Transcripts
Chapter: Receiving Uploads in Django
Lecture: Chapter review
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
This chapter has been about uploading file content. Just like any other submission, you use an HTML form, but in this case you use a special field,
0:09
both in the form and in the requests object to get at the file. There are three high level abstractions of content in Django. A page through a view.
0:20
A static file, like a style sheet, or media files from uploads. Media files should be uploaded to a directory outside of your code.
0:29
The name of the file on the server doesn't have to be the same name the user gave it.
0:34
And in particular it is best practice not to trust what the user named it. At bare minimum you probably want the users ID
0:41
in the file path so that one user doesn't overwrite another user's file of the same name.
0:48
And finally I got all paranoid telling you the internet is full of jerks and you have to be very careful when accepting content from said jerks.
0:57
That's it for uploads. In the next chapter, I'll be covering how to write your own Django management commands.