Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mime = magic.Magic(mime=True)
- content_type = mime.from_buffer((data).read(1024))
- request.session['content_type'] = content_type
- if content_type == 'application/pdf' or content_type == 'application/msword':
- request.session['upload_status'] = "Content type is valid according to (MAGIC)"
- import magic
- magic.from_buffer(open("testdata/test.pdf").read(1024))
Add Comment
Please, Sign In to add comment