Webcam snapshot route from flash to FMS to php to mysql

The route must remain the same.

I make a snapshot of webcam in clients flash, then convert bitmapdata to jpg as ByteArray data type.

Now i send it to FMS:


netconnection.call("snapShot",null,byteArray);

When i trace byteArray on server side, i get [object ByteArray].

Now i need to use LoadVars class to send this jpg image to php.


mysql = new LoadVars();
mysql.userid = thisclient.userid;
mysql.jpg = jpgData;
mysql.contentType = "application/octet-stream";
mysql.send("snapshot.php");

Now in php i would like to add this image to mysql database.


$userid = $_POST["userid"];
$jpg = $GLOBALS["HTTP_RAW_POST_DATA"];

if($userid){
	$result = mysql_query("UPDATE tabelname SET snapshot = '".$jpg."' WHERE host = '".$userid."'");
}

snapshot field type is longblob.

Result: nothing.

Am i doing something wrong in final steps or between or both. Need some advice please!