I'm able to upload an image file and using PHP's file_get_contents
put the binary into memory. From there I've attempted to use a basic update
or insert
query statement to then put that data into a blob. It keeps throwing errors.
In addition I've tried to use the addslashes
PHP function as well, and it still doesn't work.
I've tried:
if (is_uploaded_file($_FILES['myFile']['tmp_name'])){
$fileData = file_get_contents($_FILES['myFile']['tmp_name']);
$fileData = unpack("H*hex",$fileData);
$content = "0x" . $fileData['hex'];
}
Then I try to insert
into my database and it doesn't work either.
The datatype for my BLOB field is image
.
The error I am most often getting is:
mssql_query(): message: Operand type clash: text is incompatible with image (severity 16)
Any help would be appreciated!