Elke Stahl wrote:
i successfully stored blobs in an oracle table via php. but it seems to be impossible getting them back to filesystem!
It is a binary (no picture or executable) which arives via mail and is written into a unix-filesystem. iÂve stored this binary as blob datatype together with other informations in a table with the help of a php-script. afterwards the binary will be deleted from filesystem. If the binary is to be used again, it should be read out of the database and written back into the unix-filesystem. I need a solution for the last part.
Maybe something like:
$query = 'SELECT BLOBDATA FROM BTAB WHERE BLOBID = '.MYBLOBID; $stmt = OCIParse ($conn, $query); OCIExecute($stmt, OCI_DEFAULT); OCIFetchInto($stmt, $arr, OCI_ASSOC); $result = $arr['BLOBDATA']->load();
$fh = fopen('c:/temp/sometempfile.pdf', 'wb'); fwrite($fh, $result); fclose($fh);
Depending how the file is to be used, maybe it is worth checking whether it really needs to be written back to the filesystem. For example files stored in Oracle 9i can be accessed directly by a URL. Another example: the PL/SQL UTL_SMTP package could be used to mail it.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php