Hi,
I have a windows 2000 Database Server with IBM DB2 V7.2 FP5
I have a linux web server with Apache/PHP
I installed IBM DB2 IMAGE Extender and enable my database for it.
Now I'm uploading a file to the server and I want to copy this file in the
database.
I'm using the following script:
$userfile=str_replace("\\\\","\\",$userfile);
$TableName="imgdb";
$FieldName1="imgname";$FieldValue1="'".session_id()."'";
$FieldName2="imgval";$FieldValue2="'".$userfile."'";
$insOS="Insert Into $TableName ($FieldName1,$FieldName2)
values($FieldValue1,MMDBSYS.DB2IMAGE('MyDatabase',$FieldValue2,'ASIS',1,'Thi
s my image'));";
$resultOSins=odbc_exec($conn,$insOS);
$userfile is the file uploaded by the user using an INPUT type=FILE
I received the following error:
Warning: SQL error: [IBM][CLI Driver][DB2/NT] SQL0443N Routine
"MMDBSYS.DB2IMAGE" (specific name "DB2IMAGEIMPORTF1") has returned an error
SQLSTATE with diagnostic text "Can't resolve import file. ". SQLSTATE=38686
, SQL state 38686 in SQLExecDirect in /svr/myfile.php
But if I have $userfile="C:\myimage.jpg";
it will work (of course if the file is present on the C drive...)
My question is How can I insert an image in the database without using its
file name ?
Can I directly send the image object to the database ?
Thanks
Jerry
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php