| Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2026-02-25 (1 month ago)  | | Not yet rated by the users | | Total: Not yet counted | | Not yet ranked |
| Version | | License | | PHP version | | Categories |
| aos-zip-extract 1.0.0 | | Custom (specified... | | 8.4 | | Compression, AJAX, PHP 8 |
|
| Description | | Author |
This package can show progress of Zip file extraction on the server.
It provides an example script that calls the TZipHandler class to extract the files of a given ZIP file on the server side.
The script also implements a callback function that can show a progress bar on the page the current user is seeing to show the progress of the Zip file that is being extracted. Innovation Award
 February 2026
Number 2 |
Zip files are used by many developers and users of websites and applications to distribute a list of archives and folders in a single file that is compressed to occupy less storage space.
Extracting a ZIP archive file may take a long time depending on the size of the file.
If the users waiting for the ZIP archive do not see if the archive is being extracted, they may think that the archive is not being extracted.
This package provides an example script to show how a PHP web application can extract a Zip archive on the server and show a progress bar on a web page to show how much of the archive was extracted on the server at each moment.
This way the users can see how much of the archive was extracted and how much remains to be extracted.
Manuel Lemos |
| |
 |
|
Innovation award
 Nominee: 21x
Winner: 4x |
|
Instructions
Example
<?php
/**
* @ASCOOS-NAME : Ascoos OS
* @ASCOOS-VERSION : 1.0.0
* @ASCOOS-SUPPORT : support@ascoos.com
* @ASCOOS-BUGS : https://issues.ascoos.com
*
* @CLASS-METHOD-STUDY : TZipHandler::extractWithProgress()
* @file : extractWithProgress.php
* @test : callback that sends JSON progress to the browser
*
* @desc <English> It demonstrates the use of the extractWithProgress method, which sends JSON progress to the browser via a callback
* @desc <Greek> ?????????? ??? ????? ??? ??????? extractWithProgress ??? ???? callback ??????? JSON progress ???? browser
*
* @since PHP 8.3.0
*/
declare(strict_types=1);
use ASCOOS\OS\Kernel\Archives\TZipHandler;
session_start();
// <EN> We save the progress in the session so that Ajax can read it
// <EL> ???????????? ??? ?????? ?? session ??? ?? ??? ???????? ?? Ajax
function ajaxProgressCallback(int $current, int $total, string $entryName = ''): void {
$_SESSION['zip_progress'] = [
'current' => $current,
'total' => $total,
'percent' => $total > 0 ? round(($current / $total) * 100, 2) : 0,
'entry' => $entryName,
];
// session_write_close(); // ????????? ??? AJAX ?? ???????? ?? session
}
// <EN> Starting decompression (once)
// <EL> ???????? ???????????? (??? ????)
if (!isset($_SESSION['zip_started'])) {
$_SESSION['zip_started'] = true;
$zipHandler =& TZipHandler::getInstance();
$zipHandler->extractWithProgress('/path/to/archive.zip', '/path/to/target', 'ajaxProgressCallback');
}
// <EN> Endpoint to return the current progress
// <EL> Endpoint ??? ?? ?????????? ??? ???????? ??????
header('Content-Type: application/json');
echo json_encode($_SESSION['zip_progress'] ?? ['current'=>0,'total'=>0,'percent'=>0,'entry'=>'']);
?>
|
Details
ZIP Extraction with Real-Time Progress (AJAX + PHP)
This is an example implementation of extracting a ZIP archive with live progress updates in the browser using AJAX, with progress stored in the PHP session.
It demonstrates the use of the extractWithProgress() method of the TZipHandler class from Ascoos OS.
Features
-
Real-time progress bar (percentage + current file name)
-
AJAX polling (no WebSocket required)
-
Progress stored in `$_SESSION`
-
jQuery interface
-
Handles empty archives & completion state
Requirements
-
PHP ? 8.3
-
Ascoos OS 1.0.0 or AWES 26 Pro
-
Sessions enabled
-
Write permissions on the extraction folder
-
jQuery
Installation
-
Download or clone the repository
-
Place the files on your web server
-
Adjust the paths inside `extractWithProgress.php` to match your environment:
$zipHandler->extractWithProgress(
'/path/to/your/archive.zip',
'/path/to/extraction/folder',
'ajaxProgressCallback'
);
Usage
-
Open `extractWithProgress.html` in your browser
-
Click Start Extract
-
Watch the progress bar and file log update in real time
Example output:
Extracted: folder/config.ini
Extracted: images/logo.png
...
Completed!
How it works (simplified)
Browser ---> Click "Start" ---> AJAX polling every 1s ---> extractWithProgress.php
|
v
reads $_SESSION['zip_progress']
|
v
returns JSON ? updates bar & log
The extraction runs inside one long PHP request, while progress is stored in the session and read by lightweight AJAX calls.
License
AGL (Ascoos General License).
© 2025-2026 Ascoos OS
| |
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.