[Zope] image uploading problems: changing of object type

Jonathan Hobbs toolkit at magma.ca
Mon Jul 12 12:32:29 EDT 2004


From: "R Karthick" <catchkarthick at yahoo.com>
> thank you for you reply.
>
> Infact i changed the content-type to text/xml.
> Eventhough the content_type  of the file changes, it
> still remains an "Image" and that gives me problems.
> Can i change the type of the file using some api
> function? It is like changing the type from
> dtml-method to zpt file. similarly from Image to
> ordinary "file".

You could try the 'update_data' api routine (details can be found in the
zope book).


Jonathan


> --- Jonathan Hobbs <toolkit at magma.ca> wrote:
> > From: "R Karthick" <catchkarthick at yahoo.com>
> > > I upload images in to a ftp upload enabled folder.
> > My
> > > task is to base64 encode
> > > the images and put it into another directory. I
> > base64
> > > encode the files using
> > > the external method. When i upload it, ZOPE takes
> > the
> > > default type as image.
> > > Now if i rename the file into a *.dat file, then
> > the
> > > encoding works.
> > >
> > > Now can i change the type of the object from
> > "image"
> > > to ordinary "file" from a
> > > script python.
> >
> > You can change the content type when you add the
> > object:
> >
> > contentType = 'image/jpeg'
> > folder.manage_addFile(id=thisId, file=filedata,
> > title=afile,
> > content_type=contentType)
> >
> > You can set contentType to any valid MIME type.
> >
> > HTH
> >
> > Jonathan
> >
> >
> >
> >
>
>
> =====
> with "freedom" comes great responsibilities
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>




More information about the Zope mailing list