2

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!

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.