Question

import StringIO
import magic

m = magic.Magic()
thefile = StringIO.StringIO(request.raw_post_data)  # I got this from Django. ajax file uploader.

what now?

Was it helpful?

Solution

...should be as easy as:

 >>> m.from_buffer(thefile.read(1024))
'PDF document, version 1.2'

OTHER TIPS

It looks like you need to use the from_buffer method.

m.from_buffer(theFile)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top