WordPress.org

Codex

Function Reference/unzip file

Contents

Description

Unzip's a specified ZIP file to a location on the Filesystem via the WordPress Filesystem Abstraction.Assumes that WP_Filesystem() has already been called and set up. Does not extract a root-level __MACOSX directory, if present.

Attempts to increase the PHP Memory limit to 256M before uncompressing, However, The most memory required shouldn't be much larger than the Archive itself.

Usage

<?php unzip_file$file$to ); ?>

Parameters

$file
(string) (required) Full path and filename of zip archive
Default: None
$to
(string) (required) Full path on the filesystem to extract archive to
Default: None

Return Values

(mixed) 
WP_Error on failure, True on success

Change Log

Since: 2.5

Source File

unzip_file() is located in wp-admin/includes/file.php