content type of the uploaded file

Diez B. Roggisch nospam-deets at web.de
Mon Feb 23 16:05:23 CET 2004


ketulp_baroda at yahoo.com wrote:
> I want to determine the content type of uploaded file.
> File was uploaded by using <input type=file>.
> How can I determine the content type?

I don't know if the http-spec does require a mime-type - neverless you can't
and shouldn't trust that a uploaded file is what the user wants you to
believe it is.... so it would be the best to invoke 'file' on your received
file. It has the -i option to give you the mime-type.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list