summaryrefslogtreecommitdiff
path: root/test/index.php
blob: 33e2fc55fee73a2089cd1cbdd983d7b9e74b3305 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

# load zipstream class
require '../zipstream.php';

# add some random files
$files = array(
  '/store/dl/wurfl.xml.gz',
  '/store/dl/hugh_hefner_interview.html',
);

$zip = new ZipStream('test.zip', array(
  'comment' => 'this is a zip file comment.  hello?'
));

$file_opt = array(
  'time'    => time() - 2 * 3600,
  'comment' => 'this is a file comment. hi!',
);

# add files under folder 'asdf'
foreach ($files as $file)
  $zip->add_file('asdf/' . basename($file), file_get_contents($file), $file_opt);

# add same files again wihtout a folder
foreach ($files as $file)
  $zip->add_file(basename($file), file_get_contents($file), $file_opt);

$zip->finish();

?>