Sample code for 30+ languages & platforms
PHP

Load Entire File into BinData

Demonstrates how to load an entire file into a BinData object.

Chilkat PHP Downloads

Chilkat2 PHP
<?php

use Chilkat2\BinData;
use Chilkat2\FileAccess;

$fac = new FileAccess();

try {
    $fac->OpenForRead('qa_data/pdf/sample.pdf');

    $bd = new BinData();
    $maxBytesToRead = 99999999;
    $fac->FileReadBd($maxBytesToRead, $bd);
} catch (\Chilkat2\Exception $e) {
    echo $e->getMessage(), "\n";
    exit;
}

$fac->FileClose();

// The bd object contains the file data...
$bd->WriteFile('qa_output/sample.pdf');