So our application supports both MySQL and SQL Server, and we store images in the database.
Now the following code works for MySQL just fine, but not at all for SQL Server. I keep getting an "MDB2: Syntax Error". At first, I had the column as an IMAGE and then I changed it to VARBINARY(MAX) and I still can't figure out what's wrong. Any Ideas?
// we save it to an object
$objFile->TempFileName = $_FILES['files']['tmp_name'][0]['filecontents'];
// then, this is our object's store method
$FileHandle = fopen($this->TempFileName, 'rb');
$FileData = fread($FileHandle, 1024 * CONFIG_DIGITALLIBRARY_PREVIEW_LONG_MAX_SIZE);
//...
$query = "UPDATE tblDigitalLibrary_Files SET FileContents = ? WHERE ID = ?";
$firstUpdatePrep = $_ARCHON->mdb2->prepare($query, array('blob', 'integer'), MDB2_PREPARE_MANIP);
$affected = $firstUpdatePrep->execute(array($FileData, $this->ID));