[Zope] Image problem
Dragos Chirila
d.chirila at bucarest.finsiel.ro
Tue Jan 13 03:04:39 EST 2004
Hi
The problem is the order of the parameters in method 'manage_addImage':
Here is definition from Image.py:
def manage_addImage(self, id, file, title='', precondition='',
content_type='',
REQUEST=None):
"""
Add a new Image object.
Creates a new Image object 'id' with the contents of 'file'.
"""
....
So, it's:
context.Pictures.manage_addImage(id, file, title)
Dragos
> Hello
> I have added an image through the form as -
>
> <form action="createimage" method="post" enctype="multipart/form-data">
> <input type="text" name="id">
> <input type="text" name="title">
> <input type="file" name="file">
> <input type="submit">
> </form>
>
> this is processed by a script called "createimage" as in your forms method
> defined:
> ## Script (Python) "doupload"
> ##bind container=container
> ##bind context=context
> ##bind namespace=
> ##bind script=script
> ##bind subpath=traverse_subpath
> ##parameters=id, title, file
> ##title=
> ##
> context.Pictures.manage_addImage(id,title,file)
>
> ALTHOUGH -
> This does create the image in the Pictures folder.
> But the type in the context are 'application/octet-stream'
> and not as an image/jpeg as I need it to be.
>
> HOW can I identify the correct type for the file in the code please
>
> Many thanks
> Eva Rowe
>
>
> _______________________________________________
> 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