Problem saving(or reading) pdf into oracle
Posted: Fri Sep 21, 2007 7:13 am
I have a form that uploads a pdf into an oracle blob. The code looks something something like this(not the exact code).
The problem is that when I read the file some of the characters looks wrong. The size in the database and in the original file is the same. I am wondering if there is a character set issue.?? Is the problem in the writing or in the reading? I will post the reading code later.
First few characters of each file. Notice the diff characters in the second line
The original
The one from the database
Code: Select all
$filename = temp_file_from_form;
$handle = fopen($filename, "r");
$blob_data = fread($handle, filesize($filename));
fclose($handle);
$sql = "Store Procedure with Parameters, one of them the blob";
$stmt = $db->PrepareSP($sql);
$db->InParameter($stmt, $id, 'id');
$blob = $db->InParameter($stmt, $blob_data, 'photo',-1, OCI_B_BLOB);
$db->StartTrans();
$ok = $db->Execute($stmt);First few characters of each file. Notice the diff characters in the second line
The original
Code: Select all
%PDF-1.3
%âãÏÓ
5 0 obj
<<
/Length 197
/Filter /FlateDecode
>>Code: Select all
%PDF-1.3
%¿¿¿¿
5 0 obj
<<
/Length 197
/Filter /FlateDecode
>>