[Zope-DB] Help on storing images in Postgresql
CY
CY" <cyhoong@pc.jaring.my
Fri, 4 Apr 2003 22:33:50 +0800
This is a multi-part message in MIME format.
------=_NextPart_000_003F_01C2FAFA.43DFBEA0
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0040_01C2FAFA.43DFBEA0"
------=_NextPart_001_0040_01C2FAFA.43DFBEA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello
I need some help ins storing .gif & jpeg files in Postgresql.=20
My current server is running Zope2.5.1 on RH8.0 with Postgresql7.2.2.
I have create a simple form to capture some digital images for uploading =
to Zope server from my PC (WIn98).
However I encounter an error message (below).
=20
The system is looking for the images in server while the actual image is =
in the PC. How I do "tell" the system
the location of the image file?
TQ in advance
Z SQL Method at /STARS/Photo/uploadPhoto_sql Help! =20
-------------------------------------------------------------------------=
-------
Error, psycopg.IntegrityError: ERROR: lo_import: can't open unix file =
"g:images=08irds.gif": No such file or directory insert into photo( =
person_id, comments, pic) values ('robert', 'happy bird day', lo_import =
('g:\images\birds.gif') )=20
-------------------------------------------------------------------------=
-------
SQL used:
insert into photo(
person_id, comments, pic)=20
values
('robert',=20
'happy bird day',
lo_import ('g:\images\birds.gif')
)
Photo upload Form
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
<dtml-var standard_html_header><h2><dtml-var title_or_id></h2>
<form action=3D"uploadPhoto_action" method=3D"post"><table> <tr> =
<td>Person ID:</td> <td><input type=3D"text" name=3D"person_id" =
maxlength=3D"16" size=3D"20"></td> </tr> <tr> <td>Comments:</td> =
<td><input type=3D"text" name=3D"comments" maxlength=3D"20" =
size=3D"20"></td> </tr> <tr> <td>Filename: </td> <td><input =
type=3D"file" name=3D"pic" accept=3D"image/*"> </tr> =
<tr><td> </td></tr> <tr> <td align=3D"right"><input =
type=3D"reset" name=3D"submit" value=3D"Reset"></td> <td><input =
type=3D"submit" name=3D"submit" value=3D"Upload"></td> </tr>
<dtml-var standard_html_footer>
uploadPhoto_action Method
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
<dtml-var standard_html_header><h2><dtml-var title_or_id> <dtml-var =
document_title></h2>
<dtml-call "uploadPhoto_sql (cust_id=3DREQUEST.get('person_id'), =
comments=3DREQUEST.get('comments'), =
pic=3DREQUEST.get('pic') )">
<dtml-call "RESPONSE.redirect('uploadPhoto_form')">
<dtml-var standard_html_footer>
------=_NextPart_001_0040_01C2FAFA.43DFBEA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I need some help ins storing .gif & =
jpeg files=20
in Postgresql. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>My current server is running =
Zope2.5.1=20
on RH8.0 with Postgresql7.2.2.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I have create a simple form to capture =
some digital=20
images for uploading to Zope server from my PC (WIn98).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>However I encounter an error message=20
(below).</FONT></DIV>
<DIV><!--StartFragment --> </DIV>
<DIV><FONT face=3DArial size=3D2>The system is looking for the images in =
server=20
while the actual image is in the PC. How I do "tell" the=20
system</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>the location of the image =
file?</FONT><BR></DIV>
<DIV><FONT face=3DArial size=3D2>TQ in advance</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR class=3Dlocation-bar>
<TD vAlign=3Dtop align=3Dleft>
<DIV class=3Dstd-text><IMG alt=3D"Z SQL Method"=20
src=3D"http://lifebook:8080/misc_/ZSQLMethods/sqlmethod.gif" =
border=3D0>=20
<STRONG>Z SQL Method at <A=20
href=3D"http://lifebook:8080/manage_workspace"> /</A><A=20
href=3D"http://lifebook:8080/STARS/manage_workspace">STARS</A>/<A=20
=
href=3D"http://lifebook:8080/STARS/Photo/manage_workspace">Photo</A>/<A=20
class=3Dstrong-link=20
=
href=3D"http://lifebook:8080/STARS/Photo/uploadPhoto_sql/manage_workspace=
">uploadPhoto_sql</A>=20
</STRONG></DIV></TD>
<TD vAlign=3Dtop align=3Dright>
<DIV class=3Dstd-text><A=20
onmouseover=3D"window.status=3D'Open online help'; return true;"=20
=
onclick=3D"window.open('http://lifebook:8080/HelpSys?help_url=3D/Control_=
Panel/Products/ZSQLMethods/Help/Z-SQL-Method_Edit.stx','zope_help','width=
=3D600,height=3D500,menubar=3Dyes,toolbar=3Dyes,scrollbars=3Dyes,resizabl=
e=3Dyes').focus(); return false;"=20
onmouseout=3D"window.status=3D''; return true;"=20
=
href=3D"http://lifebook:8080/HelpSys?help_url=3D/Control_Panel/Products/Z=
SQLMethods/Help/Z-SQL-Method_Edit.stx">Help!</A>=20
</DIV></TD></TR></TBODY></TABLE></DIV>
<DIV>
<HR>
</DIV>
<DIV><STRONG>Error, <EM>psycopg.IntegrityError</EM>:</STRONG> ERROR: =
lo_import:=20
can't open unix file "g:images=08irds.gif": No such file or directory =
insert into=20
photo( person_id, comments, pic) values ('robert', 'happy bird day', =
lo_import=20
('g:\images\birds.gif') ) </DIV>
<DIV>
<HR>
</DIV>
<DIV><STRONG>SQL used:</STRONG><BR></DIV><PRE>insert into photo(
person_id, comments, pic)=20
values
('robert',=20
'happy bird day',
lo_import ('g:\images\birds.gif')
)</PRE><PRE>Photo upload =
Form</PRE><PRE>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</PR=
E><PRE><dtml-var standard_html_header><BR><h2><dtml-var =
title_or_id></h2></PRE><PRE><form =
action=3D"uploadPhoto_action" =
method=3D"post"><BR><table><BR> =
<tr><BR> <td>Person =
ID:</td><BR> <td><input =
type=3D"text" name=3D"person_id" maxlength=3D"16" =
size=3D"20"></td><BR> </tr><BR> =
<tr><BR> =
<td>Comments:</td><BR> =
<td><input type=3D"text" name=3D"comments" maxlength=3D"20" =
size=3D"20"></td><BR> </tr><BR> =
<tr><BR> <td>Filename: =
</td><BR> <td><input =
type=3D"file" name=3D"pic" accept=3D"image/*"><BR> =
</tr><BR> =
<tr><td>&nbsp;&nbsp;</td></tr><BR> =
<tr><BR> <td =
align=3D"right"><input type=3D"reset" name=3D"submit" =
value=3D"Reset"></td><BR> =
<td><input type=3D"submit" name=3D"submit" =
value=3D"Upload"></td><BR> =
</tr></PRE><PRE><dtml-var standard_html_footer></PRE><PRE>
uploadPhoto_action =
Method</PRE><PRE>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D</PRE><PRE><dtml-var =
standard_html_header><BR><h2><dtml-var title_or_id> =
<dtml-var document_title></h2></PRE><PRE> <dtml-call =
"uploadPhoto_sql<BR> =
(cust_id=3DREQUEST.get('person_id'),<BR> &nb=
sp; =
comments=3DREQUEST.get('comments'),<BR> &nbs=
p; pic=3DREQUEST.get('pic') )"></PRE><PRE> <dtml-call =
"RESPONSE.redirect('uploadPhoto_form')"></PRE><PRE><dtml-var =
standard_html_footer></PRE></BODY></HTML>
------=_NextPart_001_0040_01C2FAFA.43DFBEA0--
------=_NextPart_000_003F_01C2FAFA.43DFBEA0
Content-Type: image/gif;
name="sqlmethod.gif"
Content-Transfer-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