Page 1 of 1

[WITHDRAWN] OCI_lob::load() fails in IE

Posted: Fri Jul 22, 2011 12:24 pm
by vaughtg
I have a button that opens a window (via window.open()) with the following at its content.

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'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.

Re: OCI_lob::load() fails in IE (read() does, as well)

Posted: Tue Jul 26, 2011 4:22 am
by Benjamin
I think some versions of IE had issues if the payload was less than 512 bytes. That's just a wild guess though, without knowing the actual error message.

Re: OCI_lob::load() fails in IE (read() does, as well)

Posted: Thu Apr 12, 2012 8:15 pm
by vaughtg
Okay this was a LONG time ago (I think) and it's been resolved. I'm not sure what the resolution was, so I'm going to mark this as [WITHDRAWN] since the resolution doesn't appear to be *here*.