开发者

I want php zip class extension to compress a directory , but without temp files

I want an extension to compress directory with all files and sub-dir开发者_如何学编程s inside it, but without creating a temp files, i want the extrnsion name with a code for how to use it ?

i have an errors when the class making a temp files

Thank you ,


You want http://pablotron.org/software/zipstream-php/. From the documentation:

1.  Create the zip stream:

    $zip = new ZipStream('example.zip');

2.  Add one or more files to the archive:

    # add first file
    $data = file_get_contents('some_file.gif');
    $zip->add_file('some_file.gif', $data);

    # add second file
    $data = file_get_contents('some_file.gif');
    $zip->add_file('another_file.png', $data);

3.  Finish the zip stream:

    $zip->finish();

I will warn you: if you're dealing with very large files the zip will break. it works well on small files, but not on 10s of megabytes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜