[Zope] Content-Type missing for uploads?

Loren Stafford lstafford@morphics.com
Fri, 1 Jun 2001 10:20:43 -0700


Sorry Alex,

This was stuff I did so long ago I can't remember what I did, nor who I
stole it from.

getMimeType is an external method that goes like this:

import string

def getMimeType(self,file):
  __allow_access_to_unprotected_subobjects__=1
  contentHeader=file.headers.headers[1]
  mimeType=string.split(contentHeader, ': ')[1]
  return mimeType

The site is a private corporate internet, so you can't go there anyway.

-- HTH
-- Loren

> -----Original Message-----
> From: Alex [mailto:alex@quad.com.ar]
> Sent: Friday, June 01, 2001 09:54
> To: Loren Stafford
> Subject: Re: [Zope] Content-Type missing for uploads?
>
>
> thanks for your reply, but I'm afraid <dtml-boundary> is something to be
> used within <dtml-mime> which is part of the <dtml-sendmail> tag.
> well, I tried it anyway, and I get an error on 'getMimeType'
> being invalid.
>
> anyway, what is the url of that site you mentioned?
>
> Thanks!
>
> alex
>
>
>
> ----- Original Message -----
> From: "Loren Stafford" <lstafford@morphics.com>
> To: "Alex" <alex@quad.com.ar>; <zope@zope.org>
> Sent: Thursday, May 31, 2001 11:01 PM
> Subject: RE: [Zope] Content-Type missing for uploads?
>
>
> > Here's some code I found on my site:
> >
> > <dtml-boundary type_expr="getMimeType(CVfile)"
> > name_expr="uploadFileName(CVfile.filename)"
> > disposition=attachment encode=base64>
> >
> > getMimeType(UploadFileObject) seems to be the trick.
> >
> > -- Loren
> >
> >
> > > -----Original Message-----
> > > From: zope-admin@zope.org [mailto:zope-admin@zope.org]On
> Behalf Of Alex
> > > Sent: Thursday, May 31, 2001 17:43
> > > To: zope@zope.org
> > > Subject: [Zope] Content-Type missing for uploads?
> > >
> > >
> > > How can I get the Content-Type of a file that has been uploaded
> > > with a form?
> > >
> > > example:
> > >
> > > <form method="post" enctype="multipart/form-data">
> > > <input type="file" name="myfile">
> > > <input type="submit">
> > > </form>
> > >
> > > when you upload a file with this form, the browser sends the
> > > Content-Type of
> > > "myfile" , the question is: How can I get that Content-Type
> > > information from
> > > zope?
> > >
> > > By the way,  it's not REQUEST.CONTENT_TYPE, as this is set to
> > > multipart/form-data.
> > >
> > > any ideas??
> > > Thanks
> > >
> > > Alex
> > >