I would like to pass a PDF file to a binary text string to store it in a field of a SQL Server database (VarBinary).
The Java code that is responsible for storing it is the following:
FileInputStream fis = new FileInputStream(doc);
stmt.setBinaryStream(7, fis, (int) image.length());
System.out.println((int) image.length());
stmt.execute();
What would be the equivalent in PHP? I'm using the file_get_contents () function but it has nothing to do with what I get in Java with this.
To view it from PHP I do the following:
$content = sqlsrv_get_field( $result, 1,SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY));
file_put_contents($path, $content);