API16

JArchiveZip/create

From Joomla! Documentation

< API16:JArchiveZip
Revision as of 17:47, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Create a ZIP compressed file from an array of file data. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JArchiveZip/create|Edit De...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Create a ZIP compressed file from an array of file data.

[Edit Descripton]

Template:Description:JArchiveZip/create

Syntax[edit]

create($archive, $files, $options=array())
Parameter Name Default Value Description
$archive $archive Path to save archive
$files $files Array of files to add to archive
$options array() $options Compression options [unused]

Returns[edit]

boolean True if successful

Defined in[edit]

libraries/joomla/filesystem/archive/zip.php

Importing[edit]

jimport( 'joomla.filesystem.archive.zip' );

Source Body[edit]

function create($archive, $files, $options = array ())
{
        // Initialise variables.
        $contents = array();
        $ctrldir  = array();

        foreach ($files as $file)
        {
                $this->_addToZIPFile($file, $contents, $ctrldir);
        }
        return $this->_createZIPFile($contents, $ctrldir, $archive);
}

[Edit See Also] Template:SeeAlso:JArchiveZip/create

Examples[edit]

<CodeExamplesForm />