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

Patrick Ulmer ulmer at truckport.de
Fri Sep 17 03:43:45 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".*

What's wrong?

I also want to put the filename in my database, but the Internet 
Explorer gives me the filename with path. Is there a funtionc to get the 
filename without path?

Thanks,
Patrick




More information about the Zope mailing list