PHP Classes

File: example

Recommend this page to a friend!
  Classes of Sam S   MakeCAB   example   Download  
File: example
Role: Example script
Content type: text/plain
Description: An example of MakeCab use
Class: MakeCAB
Create CAB archives from lists of files
Author: By
Last change:
Date: 17 years ago
Size: 710 bytes
 

Contents

Class file image Download
<?php
//Send the MSCAB MIME type
header("Content-Type: application/vnd.ms-cab-compressed");
//Make it an attachment
header('Content-Disposition: attachment; filename="test.cab"');
//include the class file
include("MakeCAB.class.php");
//create object
$cab = new MakeCAB("test.cab");
//add a local file system file
$cab->addfile("BuildingTradesProposal2.doc");
//add a file from a url
$cab->addurl("http://greaterfortwayne.net/favicon.ico");
//add all of the contents of a local file system directory, leaving the base directory
$cab->adddir("K:/xampp/htdocs/data/","data/");
//Make the file
$cab->WriteCAB();
//output the file
readfile("test.cab");
//delete the file
unlink("test.cab");
?>