django Upload Files
1, file upload forms where the need to meet two conditions
- Submission must be
post
- Form must provide a
enctype
property, and the value must bemultipart/form-data
- multipart / form-data representative of a form submission data stream in the form of
2, in the django, receiving the file object request.FILES
file = request.FILES.get("key")
file common methods are those?
- read (): the file is read and placed in a stream, a one-time reading is completed, suitable for small pictures
- chunks (): read the block in the manner of a document read for large files
What are common file attributes?
- name: file name
- size: file size
- content_type: File Types