php, sql server and image fields

From: Date: Wed, 30 Apr 2003 14:07:41 +0000
Subject: php, sql server and image fields
Groups: php.general 
Request: Send a blank email to php-general+get-145777@lists.php.net to get a copy of this message
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 (#145777) next »