I have done it as follows:
the binary data goes into a LONGBLOB database record (MySQL)
the data is added with the following code:
$dataToSave = addslashes(fread(fopen($fileToSave, $fileSize)))
$sql = "INSERT INTO binaryData (binaryData) VALUES (\"$dataToSave\")";
$result = mysql_query($sql) or die (mysql_error());
$resultID = mysql_insert_id;
However I have encountered a small problem (see the topic I have opened on this board). It may have to do with the fact that when you retrieve the data you have to do stripslashes, but I'm still working on that 😉