PHP Classes

File: README.md

Recommend this page to a friend!
  Packages of Christos Drogidis   TZipHandler   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: TZipHandler
Show progress of Zip file extraction on the server
Author: By
Last change: Initial
Date: 3 months ago
Size: 2,029 bytes
 

Contents

Class file image Download

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

  1. Download or clone the repository
  2. Place the files on your web server
  3. Adjust the paths inside `extractWithProgress.php` to match your environment:

    $zipHandler->extractWithProgress(
        '/path/to/your/archive.zip',
        '/path/to/extraction/folder',
        'ajaxProgressCallback'
    );
    

Usage

  1. Open `extractWithProgress.html` in your browser
  2. Click Start Extract
  3. 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