[WITHDRAWN] OCI_lob::load() fails in IE
Posted: Fri Jul 22, 2011 12:24 pm
I have a button that opens a window (via window.open()) with the following at its content.
I'm pulling a file from a BLOB in the database and attempting to display it. I'm pulling some of the associated data to facilitate reading/loading and displaying the file appropriately. This works wonderfully in Firefox, Chrome and Safari - not in IE. IE8, at least. I keep getting a notice that the displayPage.php (contains this code and nothing else) can't be downloaded. A bit of history - I've already troubleshot the blank line that WAS at the top of the file - there is NOTHING being sent to the browser before the header (as noted in the comment).
I've looked at this in a debugger - the output being sent to the browser SEEMS to be the appropriate binary data. But for some reason IE isn't displaying the appropriate file, but trying to download.
UPDATE:: I just upgraded to IE9 and it seems to be working admirably. So, the issue seems to be with IE8-, if that helps anyone to help me.
Code: Select all
<?php
session_start();
require_once '../classes/DBConnection.php';
$filePurpose = isset($_GET['type'])?$_GET['type']:"test";
$associatedId = isset($_GET['id'])?$_GET['id']:"test";
$dbconn = new DBConnection();
$conn = $dbconn->getConnection();
$query = 'SELECT FILEDATA, FILETYPE, FILENAME, FILESIZE FROM blobFiles '.
'WHERE FILEPURPOSE = :FILEPURPOSE AND ASSOCIATEDID = :ASSOCIATEDID AND '.
'USERID = :USERID';
$stid = oci_parse ($conn, $query);
if(!$stid){
$err = oci_error($stid);
$origErr = isset($_SESSION['errorMsg'])?$_SESSION['errorMsg']:"";
$msg = $origErr."\noci_error[message]=".$err[message]." ";
if(1 < $_SESSION['privLvl']) $msg.="\noci_error[offset]=".$err[offset].
" \noci_error[sqltext]=".$err[sqltext]." ";
$_SESSION['errorMsg'] = $msg;
return;
}
oci_bind_by_name($stid, ':FILEPURPOSE', $filePurpose);
oci_bind_by_name($stid, ':ASSOCIATEDID', $associatedId);
oci_bind_by_name($stid, ':USERID', $_SESSION['user']);
$success = oci_execute($stid, OCI_DEFAULT);
if(!$success){
$err = oci_error($stid);
$origErr = isset($_SESSION['errorMsg'])?$_SESSION['errorMsg']:"";
$msg = $origErr."\noci_error[message]=".$err[message]." ";
if(1 < $_SESSION['privLvl']) $msg.="\noci_error[offset]=".$err[offset].
" \noci_error[sqltext]=".$err[sqltext]." ";
$_SESSION['errorMsg'] = $msg;
return;
}
$arr = oci_fetch_assoc($stid);
$result = $arr['FILEDATA']->read($arr['FILESIZE']);
// If any text (or whitespace!) is printed before this header is sent,
// the text won't be displayed and the file won't display properly.
// Comment out this line to see the text and debug such a problem.
header("Content-type: ".$arr['FILETYPE']);
header('Content-Disposition: attachment; filename="'.$arr['FILENAME'].'"');
echo $result;
oci_free_statement($stid);
oci_close($conn); // log off
?>
I've looked at this in a debugger - the output being sent to the browser SEEMS to be the appropriate binary data. But for some reason IE isn't displaying the appropriate file, but trying to download.
UPDATE:: I just upgraded to IE9 and it seems to be working admirably. So, the issue seems to be with IE8-, if that helps anyone to help me.