[Zope-DB] Upload and download blobs to Mysql

bobb rawsystems at gmail.com
Thu Jan 13 22:37:14 EST 2005


I had posted work that I had done with this for the archive about a year
ago...
I posted it just for future generations (hehehe, actually, in case I ever
needed it).
Maybe a good google will find it.  I know that it included loading images
from the file system to the database
and displaying them, and was pretty complete (as far as what I needed)

If you can't find it, let me know and I can try to dig it out.

bobb

----- Original Message -----
From: "Guido Gloor" <haslo.ch at gmail.com>
To: <zope-db at zope.org>
Sent: Wednesday, January 12, 2005 2:26 PM
Subject: Re: [Zope-DB] Upload and download blobs to Mysql


> HI THERE (just so I shouted, too, in my answer)
>
> The problem is not so much whether you use ZPT or DTML (I prefer
> Python Scripts, but that's a programmer speaking), but that you
> initialize the HTML-Form correctly. Image uploads have to be sent as
> multipart form data with POST, otherwise you'll just receive the
> filename.
>
> Have a look here for the specifics...
> http://www.bovik.org/device-upload.html
> ...or just use this basic functionality (with the appropriate action,
> pointing to where you plan to process the data):
>
> <form name="imageform" method="post" action=""
enctype="multipart/form-data">
> <input type="text" name="title">
> <input type="file" name="imagefile">
> <input type="submit" name="ok" value="OK">
>
> You'll then have the values in your request.
>
> When you get the data back from the database, be sure to set the
> header correctly. It has to be image/jpeg for JPG files and image/gif
> for GIFs. I honestly don't know how you set the header in ZPT and
> DTML, in a Python Script it would be:
>
> RESPONSE.setHeader('Content-Type', 'image/jpeg')
>
> If you don't do that, the browser will interpret the image file as
> text and just display garbage.
>
> Hope this helps,
> Cheers, Guido
>
> On Wed, 12 Jan 2005 14:36:01 +0000 (GMT), RI-WU <umicah at yahoo.com> wrote:
> > I want to upload photos and text to mysql 4.0.21 using
> > zope 2.7.3 with page templates . I am building a site
> > and I want the user to have the opurtunity to upload
> > his news and photos .Are there any ideas, I am new I m
> > using zpt .Is dtml a better way to do this???
> > PLEEASSSE HEELP
> >
> >
> > ___________________________________________________________
> > ALL-NEW Yahoo! Messenger - all new features - even more fun!
http://uk.messenger.yahoo.com
> > _______________________________________________
> > Zope-DB mailing list
> > Zope-DB at zope.org
> > http://mail.zope.org/mailman/listinfo/zope-db
> >
>
>
> --
> http://www.haslo.ch/
> _______________________________________________
> Zope-DB mailing list
> Zope-DB at zope.org
> http://mail.zope.org/mailman/listinfo/zope-db



More information about the Zope-DB mailing list