API15

JArchiveZip/create: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m clean up
Line 2: Line 2:
Create a ZIP compressed file from an array of file data.
Create a ZIP compressed file from an array of file data.


<span class="editsection" style="font-size:76%;">
 
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>


<! removed transcluded page call, red link never existed >
<! removed transcluded page call, red link never existed >
Line 54: Line 52:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
<! removed transcluded page call, red link never existed >
<! removed transcluded page call, red link never existed >



Revision as of 13:32, 24 March 2017

Description

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


<! removed transcluded page call, red link never existed >

Syntax

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

boolean True if successful

Defined in

libraries/joomla/filesystem/archive/zip.php

Importing

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

Source Body

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

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


<! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />