(PHP Extension) Extract Files from MIME
Extract files from a MIME message. Note: This example requires Chilkat v11.0.0 or greater.
<?php
include("chilkat.php");
$success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
$mime = new CkMime();
// Load a MIME document from a file:
// (.mht and .eml files contain MIME).
$success = $mime->LoadMimeFile('mst.mht');
if ($success == false) {
print $mime->lastErrorText() . "\n";
exit;
}
$st = new CkStringTable();
$success = $mime->PartsToFiles('/temp/mimeParts',$st);
if ($success == false) {
print $mime->lastErrorText() . "\n";
exit;
}
$n = $st->get_Count();
// Display the paths of the files created:
$i = 0;
while ($i < $n) {
print $st->stringAt($i) . "\n";
$i = $i + 1;
}
?>
|