[Zope] [SOLVED] Get mime type and filename without path in python

Patrick Ulmer ulmer at truckport.de
Wed Sep 22 04:17:19 EDT 2004


Hi,

> I want to allow uploading files from my website and put it in a 
> database. My short script works:
>
> if myfile and myfile.filename != '':
>    container.dbUpdateFile (id=str (id_ds), myfile=myfile.read ())
>
> Now I want to put the mimetype in the database put how can I get the 
> mimetype?
>
> I try:
>
> import mimetypes
> guess_type(myfile.filename)
>
> but I got an the error "*You are not authorized to access this 
> resource".*


I solved my little Problem by using an External Method and the 
Python-Package mimetypes.

Thanks,
Patrick


More information about the Zope mailing list