php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
4 + 29 = ?
Subscribe to this entry?

 
 [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);
    OCIBindByName($stmt,":lob",$lob,-1,OCI_B_BLOB);
    OCIExecute($stmt,OCI_DEFAULT);
    
    if($lob->save(readf($form_data))){
       OCICommit($conn);
       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));
  fclose($fp);
  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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-04 11:33 UTC] stas@php.net
reclassify
 [2000-08-07 07:59 UTC] thies@php.net
fixed in CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 22:01:29 2024 UTC