note 111676 added to oci-lob.export
| From: | AlexiuS | Date: | Fri, 15 Mar 2013 13:30:54 +0000 |
| Subject: | note 111676 added to oci-lob.export | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194082@lists.php.net to get a copy of this message | ||
Please note, that contents of LOB is cleared after this operation. If you want to use LOB data after
exporting it to file, you should read it from file with file_get_contents().
This will not work:
<?php
if($blob) {
$filename = DOCUMENT_ROOT."/".$bildId.".jpg";
if($blob->export($filename)) {
while(!$blob->eof()){
$dbResult .= $blob->read(2000);
}
} else {
throw new Exception("Can not save the file ".$filename."!");
}
}
?>
Use this instead:
<?php
if($blob) {
$filename = DOCUMENT_ROOT."/".$bildId.".jpg";
if($blob->export($filename)) {
$dbResult = file_get_contents($filename);
} else {
throw new Exception("Can not save the file ".$filename."!");
}
}
?>
----
Server IP: 69.147.83.199
Probable Submitter: 47.67.221.164
----
Manual Page -- http://php.net/manual/en/oci-lob.export.php
Edit -- https://master.php.net/note/edit/111676
Del: integrated -- https://master.php.net/note/delete/111676/integrated
Del: useless -- https://master.php.net/note/delete/111676/useless
Del: bad code -- https://master.php.net/note/delete/111676/bad+code
Del: spam -- https://master.php.net/note/delete/111676/spam
Del: non-english -- https://master.php.net/note/delete/111676/non-english
Del: in docs -- https://master.php.net/note/delete/111676/in+docs
Del: other reasons-- https://master.php.net/note/delete/111676
Reject -- https://master.php.net/note/reject/111676
Search -- https://master.php.net/manage/user-notes.php