[Zope] Upload files in Zope and store elsewhere

Daniel.Weber@SEMATECH.Org Daniel.Weber@SEMATECH.Org
Wed, 22 Mar 2000 09:22:13 -0600


I messed around with this a little bit before giving up, though I'd like it to
work....

The problem (as I see it), is that 1) you have to get to the data and 2) you
have to format the data properly so that the database stores it properly.  What
I've gleaned is that the binary data will contain characters that confuse
whatever DA you're using (I use the ODBC adapter).  This means you'll probably
have to replace these 'confusing' characters with their 'safe' counterparts.
For the person who got it to work, it was the 0x08 character.  I believe other
DB's will choke elsewhere.  I never could figure out which characters needed
replacing and with what, so I wrote an external method to save the file and just
wrote the filename/location/upload info into the database.

This wasn't as nice as I wanted (I had security concerns putting anyone's files
on the hard drive), but it will probably work (I get sidetracked once I got the
file saved and haven't finished that project).

Let me know if you get it solved (I'm using ODBC to a cheap acess database).

> -----Original Message-----
> From: Marius Kjeldahl [mailto:marius@funcom.com]
> Sent: Wednesday, March 22, 2000 5:44 AM
> To: zope@zope.org
> Subject: [Zope] Upload files in Zope and store elsewhere
> 
> 
> After some helpful advice, I have been successful in uploading files
> (images) to Zope. Now I am trying to stuff the uploaded images in a
> MySQL database, but am not able to access the image data.
> 
> If I try to stuff the image data "raw" into the database by 
> declaring a
> image:string parameter to the ZSQL Method and  <dtml-sqlvar image> in
> the ZSQL code I get a string like "<ZPublisher.HTTPRequest.FileUpload
> instance at 87956214>".
> 
> Another approach I have tried was <dtml-var image fmt=sql-quote>, but
> this complains about the image being an instance and not a string.
> 
> Another approach has been to access the actual "raw" image data using
> image.data in various combinations, but I have not gotten this to work
> anywhere (contrary to what it seems other people have managed to do),
> see this 
> 
http://www.egroups.com/group/zope/26227.html?

posting.

Looking through Image.py I see quote a few methods for accessing the
image as a "web" object through the use of URL. Internally, Image.py
uses the data attribute extensively, but I have not been able to access
this from within DTML (and I guess this has to do with data not being
listed in either the properties or permission sections of Image.py).

My final try will probably be to resort to using an External method to
get access to the "full" Image.py object (including data), but I was
hoping to avoid this.

Has anybody done this (uploading in Zope and storing the data outside of
Zope) successfully? If so, please give me a hint..

Thanks,

Marius Kjeldahl

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )