The caller provides an open stream from which the BLOB data to be sent is read. The stream can be any type of stream that supports the 'read' operation.
Returns the PBMS BLOB reference for the BLOB data sent on success.
Returns FALSE on failure. Use pbms_errno() and pbms_error() to retrieve error details.
<?php pbms_connect(); //----------- // Create a BLOB and insert it into a table. // Assume that the table exists. $fh = fopen("MyBLOB", "r"); $blob_ref = pbms_read_stream($fh, filesize("MyBLOB"), md5_file("MyBLOB", true) ); fclose($fh); query = sprintf("insert into bobtest(id, name) Values(1, \"%s\")", $blob_ref); mysql_query($query); // Fetch the BLOB back again. $result =mysql_query("select name from bobtest where id = 1"); $row = mysql_fetch_row($result); printf("NOTE: blob ref stored in table: \"%s\" is not the same as what was inserted \"%s\" \n", $row[0], $blob_ref) $fh = fopen("MyBLOB.out", "w+"); pbms_write_stream($fh, $row[0]); fclose($fh); pbms_close(); ?>