[Zope] file-upload to mysql database

Philipp Giere p.giere@hzd.hessen.de
Thu, 13 Jun 2002 17:40:10 +0200


Hi!
Sorry if this is a newbie question but I really have tried for several
hours now and didn't manage the problem ...
I'm trying to manage the following problem:
I'd like to upload Files I read by the following Command:
imagefile=intro_image[1].read()

First Problem: Uploading it as a string causes SQL operational Errors.

So I decided to encode the whole thing base64

Iwrote a little python script that reads the data:

import base64
print base64.decodestring(datei)
return printed

and called it in the PageTemplate (ZPT) like this:

<span tal:repeat="item 
python:container.select_beschreibung_image_aus_pfad(pfad=str(here.loc))">
<img src="./intro_image" align="right" tal:replace="python:
here.intro_image(item.intro_image)">

What I got was exactly the string which started with GIF89a and so on
and NOT the Image.
Do I have to define a Content-Type or something like that?

Any ideas?

Thanks a lot!

Philipp Giere