[Zope] problem manage_upload
servel yannick
yservel@glam.ac.uk
Thu, 12 Apr 2001 04:52:03 +0100
Hi all,
I have got a problem with the manage_upload methods:
I created an uploadImage external method in order to update
programmatically. This function works perfectly when I do a simple call to
this function like this:
if REQUEST["namelogo"]<>'':
if self.i.namelogo:
self.uploadImage(obj=self.i.namelogo,
file=REQUEST["namelogo"])
else:
self.addImage(obj=self.i,
id='namelogo',file=REQUEST["namelogo"])
def uploadImage(obj,file):
f=open('%s' %(file),'rb')
f.seek(0)
contents=f.read()
f.close()
title=''
tlen = len(contents)
new_id = obj.manage_upload(contents)
#img_obj = obj.__getitem__(new_id)
return ''
The problem arose when a more complicated call to this function is made:
f = 1
for img in listfile:
if REQUEST[img]<>'':
if self.i.REQUEST[img]:
self.uploadImage(obj=self.i.filename%d %(f)
,file=REQUEST[img])
else:
self.addImage(obj=self.i, id=img
,file=REQUEST[img])
f = f + 1
Basically, it says that a string object cannot use the manage_upload method.
Any idea??
Thanks in advance,
Yannick