Re: php, sql server and image fields

From: Date: Wed, 30 Apr 2003 16:48:46 +0000
Subject: Re: php, sql server and image fields
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-145817@lists.php.net to get a copy of this message
I have tried that and it didn;t work either. I think the problem is with sql server image field so i was wondering if someone has done that before thanks csr. "Marek Kilimajer" <kilimajer@webglobe.sk> wrote in message news:3EAFDBD4.5050009@webglobe.sk... > use addslashes($file_contents) before inserting it into the database > > csr wrote: > > >could anyone help me. > > I am trying to upload a jpg file into a ms sql server 2000 database with an > > image field and it's not working. This is the code so far.. > > > > $file = fopen > > ($HTTP_POST_FILES['upload_file']['tmp_name'],'rb') > > or die ("File Open Failed "); //this is the jpg file > > > >$file_contents = fread ($file, filesize > > ($HTTP_POST_FILES['upload_file']['tmp_name'])) > > or die (" Can't read "); > > fclose ($file); > > > >//put file in database > > mssql_connect(HOST,USER,PASS) or die("unable to connect"); > > mssql_select_db(PICTURE_DBASE) or die("unable to select database"); > > //file data is the image field in the table files > > mssql_query($SQL="Insert into files (file_data) values ('$file_contents')") > > or die("MSSQL Query error: ". > > "<br><br>" ); > > > > > >I got all sort of error messages from ms sql > > > >any ideas. > > > >thanks a lot > > csr. > > > > > > > > > > > > > > >

« previous php.general (#145817) next »