It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
开发者_如何学Python
Closed 10 years ago.
import StringIO
import magic
m = magic.Magic()
thefile = StringIO.StringIO(request.raw_post_data) # I got this from Django. ajax file uploader.
what now?
...should be as easy as:
>>> m.from_buffer(thefile.read(1024))
'PDF document, version 1.2'
It looks like you need to use the from_buffer method.
精彩评论