[Zope] Getting image

Michel Pelletier michel@digicool.com
Wed, 15 Mar 2000 12:46:56 -0800


Daniel.Weber@SEMATECH.Org wrote:
> 
> I guess I'm confused.  I can't get to the actual jpeg image? 

Not directly from DTML.  You need to use a method on the Image object. 
manage_FTPget().

> Here's what I'm
> trying to do.  I want to create a form to upload data.  This data can be off any
> type.  The data is stored in an ODBC database table along with it's mime type.
> So, on the upload action form, I need to 1)  get the mime type and 2) get the
> actual data.

This is different from the first question that you asked.  In this case,
when your form uploads the file contents, ZPublisher will marshal that
into a StringIO object (which acts just like a python file object).  In
this case you can just do:

<dtml-var "REQUEST['name_of_form_element_that_is_the_file'].read()">

and get the 'contents' of the file.

> Another part of the site mails off these items as attachments.
> I've heard that the mime type should be uploaded along with the data, I just
> don't know how to get to it.

In this case, your taking about a Zope 'Image' object, _not_ a standard
file object like you get when you upload data.  For this you need
manage_FTPget().

-Michel