PHP Velho Oeste 2024

OCI-Lob::export

(No version information available, might only be in Git)

OCI-Lob::exportExporta el contenido de un LOB a un fichero

Descripción

OCI-Lob::export ( string $filename , int $start = ? , int $length = ? ) : bool

Exporta el contenido de un LOB a un fichero.

Parámetros

filename

La ruta del fichero.

start

Indica desde dónde se empieza a exportar.

length

Indica la longitud de los datos a exportar.

Valores devueltos

Devuelve true en caso de éxito o false en caso de error.

Ver también

add a note add a note

User Contributed Notes 1 note

up
-1
AlexiuS
11 years ago
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."!");
    }
}
?>
To Top