[Zope-dev] Uploading a ImageFile

Steve Alexander steve@cat-box.net
Thu, 13 Jul 2000 14:58:04 +0100


Andre Schubert wrote:
> 
> Hi,
> 
> i have a question on uploading an image from my Product.
> I have a Product in http://server:8080/somewhere/Product.
> In my Product i call:
>             self._setObject(id, File(id,title,'',content_type,
> precondition))
>             self._getOb(id).manage_upload(file)
> Now the image is on http://server:8080/somewhere/Product/image right?
> 
> But i want the following:
> 
> The Product at http://server:8080/somewhere/Product at the uploaded
> Image should be stored at
> http://server:8080/anotherplace/images/ .

Let's look at what these two lines mean.

  self._setObject(id, File(id,title,'',content_type, precondition))

This line adds a new object to the "self" object. Instead, you should
replace "self" with a reference to the object that you want to put the
image in.


  self._getOb(id).manage_upload(file)

This line gets the newly-created image object from "self", and fills it
with image data. You'll want to replace "self" with that same reference
you replaced it with in the last line.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net