0
1.
[Image]Zip. JPG
2.
[Code][PHP] code
Decompress the ZIP file program online | www.ibtf.net
Extract ($ path. ('./' = $ unzippath )? '': $ Unzippath), $ remove); $ data = array (); if ($ result) {$ data ['statuscode'] = 200; $ list = $ zip-> listContent (); $ fold = 0; $ fil = 0; $ tot_comp = 0; $ tot_uncomp = 0; foreach ($ list as $ key => $ val) {if ($ val ['Folder'] = '1') {++ $ fold ;} else {++ $ fil; $ tot_comp + = $ val ['compressed _ size']; $ tot_uncomp + = $ val ['size'];} G ('_ unzip_end'); $ data ['message'] = 'decompress the target File :'. g2u ($ name ).'
'; $ Data ['message']. = 'extract file details: a total of'. $ fold. 'directories,'. $ fil. 'files
'; $ Data ['message']. = 'compressed file size:'. dealsize ($ tot_comp ).'
'; $ Data ['message']. = 'decompress the file size:'. dealsize ($ tot_uncomp ).'
'; $ Data ['message']. = 'Total decompression time:'. G ('_ run_start', '_ run_end', 6). 'seconds
';} Else {$ data ['statuscode'] = 300; $ data ['message']. = 'decompression failed:'. $ zip-> errorInfo (true ).'
'; $ Data ['message']. = 'execution Time:'. G ('_ run_start', '_ run_end', 6). 'seconds
';}// Exit (json_encode ($ data) ;}else {$ data = array (); $ data ['statuscode'] = 300; $ data ['message'] = 'Sorry, unknown error, cannot be decompressed :'. $ path. $ name. 'file! '; // Exit (json_encode ($ data);} echo $ data ['message']; elseif ($ _ REQUEST ["myaction"] = "dozip "): if ($ _ POST ['password']! = $ Password) die ("The entered password is incorrect. please enter it again. "); $ Data = array (); $ _ REQUEST ['type'] = 2; $ endpath = explode ("/", $ _ SERVER ['php _ SELF ']); $ endpath = $ endpath [count ($ endpath)-2]; $ file = $ _ REQUEST ['todir']? U2g (trim ($ _ REQUEST ['todir']): ".../". $ endpath; $ fileend = $ _ REQUEST ['todir']? 'Zip': $ file; $ zipname = u2g (trim ($ _ REQUEST ['toname']); $ path = dirname ($ file ); $ Zip = new PclZip ($ zipname); if (! File_exists ($ zipname) & $ Zip-> create ($ file, PCLZIP_OPT_REMOVE_PATH, $ fileend) {$ data ['statuscode'] = 200; $ list = $ Zip-> listContent (); if ($ list) {$ fold = 0; $ fil = 0; $ tot_comp = 0; $ tot_uncomp = 0; foreach ($ list as $ key => $ val) {if ($ val ['Folder'] = '1') {++ $ fold ;} else {++ $ fil; $ tot_comp + = $ val ['compressed _ size']; $ tot_uncomp + = $ val ['size'];} $ data ['message'] = 'compressing the target File :'. g2u ($ zipname ).'
'; $ Data ['message']. = 'compressed file details: a total of'. $ fold. 'directories,'. $ fil. 'files
'; $ Data ['message']. = 'compressed file size:'. dealsize ($ tot_comp ).'
'; $ Data ['message']. = 'decompress the file size:'. dealsize ($ tot_uncomp ).'
'; $ Data ['message']. = 'compression Execution time:'. G ('_ run_start', '_ run_end', 6). 'seconds
'; $ Data ['message']. =' compressed file list:
'; Foreach ($ list as $ key => $ val) {if (10> $ key) {$ key = '00 '. $ key;} elseif (100> $ key) {$ key = '0 '. $ key;} $ data ['message']. = ''. $ key. '=> '. ($ val ['Folder']? 'Directory: 'File:'). g2u ($ val ['filename']).'
';}} Else {$ data ['statuscode'] = 300; if (file_exists ($ zipname) {$ error = $ zipname.' already exists! ';} Else {$ error = $ Zip-> errorInfo (true);} $ data ['message'] = 'compression failed:'. $ error .'
'; $ Data ['message']. = 'execution Time:'. G ('_ run_start', '_ run_end', 6). 'seconds
';} Echo $ data ['message']; endif;?>