PHP Help with unzip
Posted: Fri Feb 24, 2012 11:59 am
Any help would be very appreciated.
We have a need to open different directories were a zip archive might be and unachieved the files
We will use a database to get the path for each directory and were to put the files.
I am trying to pass to a php script to unzip each file...
The database supports execute php and allows me to pass parameters to the script.
After script runs I get this results from the script
$IsOk=True
$result=failed
This is what the database code looks like
C_TEXT($result)
C_TEXT($p1)
C_TEXT($p2)
C_BOOLEAN($isOk)
$php_script_path:=Get 4D folder(Current Resources folder)+"PHP"+Folder separator+"zip_extract_to.php"
$param1:="Mark:"+"log.docx.zip"
$param2:=Get 4D folder(Current Resources folder)+"DestUnzip"+Folder separator
$p1:=Convert path system to POSIX($param1))
$p2:=Convert path system to POSIX($param2))
$isOk:=PHP Execute($php_script_path;"";$result;$p1;$p2)
This is the php script
<?php
$zip = new ZipArchive;
if ($zip->open(P1) === TRUE) {
$zip->extractTo(P2);
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
Thanks for your help in advance...
We have a need to open different directories were a zip archive might be and unachieved the files
We will use a database to get the path for each directory and were to put the files.
I am trying to pass to a php script to unzip each file...
The database supports execute php and allows me to pass parameters to the script.
After script runs I get this results from the script
$IsOk=True
$result=failed
This is what the database code looks like
C_TEXT($result)
C_TEXT($p1)
C_TEXT($p2)
C_BOOLEAN($isOk)
$php_script_path:=Get 4D folder(Current Resources folder)+"PHP"+Folder separator+"zip_extract_to.php"
$param1:="Mark:"+"log.docx.zip"
$param2:=Get 4D folder(Current Resources folder)+"DestUnzip"+Folder separator
$p1:=Convert path system to POSIX($param1))
$p2:=Convert path system to POSIX($param2))
$isOk:=PHP Execute($php_script_path;"";$result;$p1;$p2)
This is the php script
<?php
$zip = new ZipArchive;
if ($zip->open(P1) === TRUE) {
$zip->extractTo(P2);
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
Thanks for your help in advance...