[Zope] - Newbie alert - how to upload multiple images at once with manage_add_image

stefano.ciccarelli@thewhitebird.com stefano.ciccarelli@thewhitebird.com
Tue, 27 Feb 2001 16:24:17 +0100


HI,
I am trying to set up a form when a user can upload three images at 
once: one for a logo, one for a city map and one for a country map.

These images are used by a ZClass (Base classes: ZCatalog Aware, Object 
Manager) to display a hotel web page, with info about this hotel.

Authorised users are supposed to create this hotel instance.

I created a Hotel_add_form:

<HTML>
<BODY>

<p><h2>Here you can upload hotel logo and maps into the hotel 
file.</h2></p>

<form action="map_add" method="post"
enctype="multipart/form-data">
<p><b>Logo</b></p>
<input type="hidden" name="logo_id" value="logo26"> 
<p>Title: <input type="text" name="logo_title"> </p>
<p>File: <input type="file" name="file"></p><br>
<p><b>City map</b></p>
<input type="hidden" name="citymap_id" value="map26"> 
<p>Title: <input type="text" name="citymap_title"> </p>
<p>File: <input type="file" name="file"></p><br>

<input type="submit">
</form>
</BODY>
</HTML>

and a method map_add

<dtml-call
  expr="manage_addImage(
    id=logo_id, file=file, title=logo_title)">

<dtml-call
  expr="manage_addImage(
    id=citymap_id, file=file, title=citymap_title)">

<p>Thanks for your photo submission.</p>


Unfortunately when I try to use it I get the following error:

Zope Error
Zope has encountered an error while publishing this resource. 

Error Type: AttributeError
Error Value: seek



------------------------------------------------------------------------
--------

Troubleshooting Suggestions

The URL may be incorrect. 
The parameters passed to this resource may be incorrect. 
A resource that this resource relies on may be encountering an error. 
For more detailed information about the error, please refer to the HTML 
source for this page. 

If the error persists please contact the site maintainer. Thank you for 
your patience. 
 
 
   
 

Traceback (innermost last):
  File C:\Program Files\Northern\lib\python\ZPublisher\Publish.py, line 
222, in publish_module
  File C:\Program Files\Northern\lib\python\ZPublisher\Publish.py, line 
187, in publish
  File C:\Program Files\Northern\lib\python\Zope\__init__.py, line 221, 
in zpublisher_exception_hook
    (Object: CatalogAware)
  File C:\Program Files\Northern\lib\python\ZPublisher\Publish.py, line 
171, in publish
  File C:\Program Files\Northern\lib\python\ZPublisher\mapply.py, line 
160, in mapply
    (Object: map_add)
  File C:\Program Files\Northern\lib\python\ZPublisher\Publish.py, line 
112, in call_object
    (Object: map_add)
  File C:\Program Files\Northern\lib\python\OFS\DTMLMethod.py, line 
172, in __call__
    (Object: map_add)
  File C:\Program 
Files\Northern\lib\python\DocumentTemplate\DT_String.py, line 528, in 
__call__
    (Object: map_add)
  File C:\Program 
Files\Northern\lib\python\DocumentTemplate\DT_Util.py, line 337, in eval
    (Object: manage_addImage(
    id=REQUEST['logo_id'], file=REQUEST['file'], title=REQUEST
['logo_title']))
    (Info: REQUEST)
  File <string>, line 0, in ?
  File C:\Program Files\Northern\lib\python\OFS\Image.py, line 428, in 
manage_addImage
    (Object: CatalogAware)
  File C:\Program Files\Northern\lib\python\OFS\Image.py, line 277, in 
manage_upload
    (Object: logo26)
  File C:\Program Files\Northern\lib\python\OFS\Image.py, line 310, in 
_read_data
    (Object: logo26)
AttributeError: (see above)

THank you very much,

Stefano