|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5839 error on using $lob->savefile($form_data) for storing lob into oracle8 db
Submitted: 2000-07-28 17:35 UTC Modified: 2006-07-17 08:10 UTC
From: rddc at uninova dot pt Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.0.0 OS: Windows 98
Private report: No CVE-ID: None
 [2000-07-28 17:35 UTC] rddc at uninova dot pt
Instead of using $lob->savefile($form_data) for storing lob into oracle8 db, like is described in the php manual seccion oracle8 functions.
Use $lob->save(readf($form_data)) becaus function savefile doesn't store the whole lob in the orcale8 db just a part of it.

Here?s a short script for storing lob into oracle8 db
$sql  = "insert into fotos (id, dados, largura, altura, formato,tamanho)";
    $sql .= " values ($id, EMPTY_BLOB(), $largura, $altura, '$formato', $form_data_size)";
    $stmt = OCIParse($conn,"$sql returning dados into :lob");
    $lob = OCINewDescriptor($conn,OCI_D_LOB);
       echo "Blob successfully uploaded\n";
    } else {
       echo "Couldn't upload Blob\n";

Where readf is a function for reading binary data
function readf($filename)
 {$fp = fopen($filename,"rb");
  $buffer = fread($fp,filesize($filename));
  return $buffer;

Another thing try to look at the function writetofile and fwrite a see the difrences when saving a lob into a file.
When using writetofile the carriage return (0A) is converted to (0D 0A) under win98.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-04 11:33 UTC]
 [2000-08-07 07:59 UTC]
fixed in CVS
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Sep 29 18:01:25 2023 UTC