[Zope] inserting file into external db
Corbett Waddingham
corbettw@yahoo.com
Thu, 14 Jun 2001 10:16:34 -0700 (PDT)
First, hello to the list.
Second, I've recently started using Zope at work and find that it's
just different enough from Perl, C, and Java to be a little confusing,
so hopefully this won't be a patently obvious question. How do you
convince Zope to insert a MIME file into an external db properly?
Here are some code snippets of what I've tried. First, the DTML to
upload the file.
<form action="do_add_doc" method="post" enctype="multipart/form-data">
<table cellspacing="0" cellpadding="2" border="0">
<p>File<input type="file" name="doc_file" size="25" value="" >
<input class="form-element" type="submit" name="submit" value=" Add " >
Next, the DTML to process the file:
<dtml-call sqlInsertFile>
And the SQL to insert the file into the MySQL db (takes argument
doc_file, DOC_ID is set to 'auto increment'):
insert into TABLE
(DOC_ID,
DOC_FILE)
values
('0',
<dtml-sqlvar doc_file type=nb>)
The file is showing up, but it's being munged at some point. Hopefully
this is as simple as uuencoding the file or somesuch, but I can't
figure out to get Zope to do that. I should point out that it is a
requirement of this application that the documents be accessible via
ODBC, hence the MySQL db (so simply storing them in Zope's db isn't an
option, unfortunately). Any pointers would be much appreciated.
Cory
__________________________________________________
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/