Shiz
Shiz

Reputation: 693

PHP Extract Zip with loading

I am using ZipArchive in PHP to open and extract ZIP file to some destination. And I wanted to make a loading or some sort of progressbar to it especially when the ZIP file is more than 0.5GB.

It's a bit unfortunate for me, it is not around php manual nor here.

For now what I have is:

$zip = new ZipArchive;
$zip->open($newfile);
$zip->extractTo('/dest');
$zip->close();

And it is not working this way:

$zip = new ZipArchive;
$zip->open($newfile);
//show loading modal
$zip->extractTo('/dest');
//hide loading modal
$zip->close();

Upvotes: 0

Views: 285

Answers (1)

user11565847
user11565847

Reputation:

You can not add loader to show on html page in php as php is server side language it will process the file on server first. If you really want to show progress or loader you can use javascript + ajax for that, just send a ajax call to your php file and show the loader till ajax call is not completed.

Upvotes: 2

Related Questions