0

I have a set of AMFPHP services which receive from a Flex application a bytearray containing an image. So far so good. Now I need to write the bytearray to a blob field in a SQL Server database. I am using the MSSQL library and I cannot change that. How can I do that?

1
  • What code do you have now for the byte array in PHP? Commented Aug 31, 2012 at 21:01

1 Answer 1

1

Below the solution:

// Stores bytearray received from a Flex app through AMPPHP

$arrData = unpack("H*hex", $image->data);
$content = "0x".$arrData['hex'];

$sql = "insert into Images (Id, ImageData) values ($id, $content)";
mssql_query($sql);
Sign up to request clarification or add additional context in comments.

Comments

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.