Link to home
Start Free TrialLog in
Avatar of RustyRazor
RustyRazor

asked on

ASP and Plesk - ActiveX unzip component

Hi All:

I'm trying to move my ASP-scripted website to a new host (GoDaddy) and their support has been less than stellar.  I need to know how to access an ActiveX component that would allow a .zip to be unzipped on the server.

On my old host, the object is accessed as such:
    Set objZip = Server.CreateObject("XStandard.Zip")

No one seems to know what the name of this component, if any, would be on Plesk.  The also offer Window Shared Hosting, but they couldn't answer for that one either.  I get a vague response suggesting that they don't cover coding and to use whatever the "default" object is on ASP in general.

I'm frankly about to try a different web host, so I suppose anyone's recommendation for good webhosting would be a good addendum to this question.
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RustyRazor
RustyRazor

ASKER

I like your workaround and it seems reasonable.

I've been trying a standard script:

<?php
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
    $zip->extractTo('/my/unarchive/dir/');
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}
?>

Open in new window


It seems to be crashing on the extractTo line.  

I also seem to be having trouble with pathing.  for exmaple, if I specifiy /my/unarchive/dir/test.zip as the open file, the file is not found, so I had to copy the .zip file to the root directory to skip that error.  

Any thoughts?  Would there be any server-side settings I need to be aware of?  Of course the subdiectory in question has read/write permissions.
I really am not very versed in PHP.  If you look down a little in that link you will see a note about  using windows where you have to account for the back slash. See if this works.

Make attention when using this function with apache & windows system. Windows file system use \  (backslash) instead of unix / (slash) 
Use str_replace like this. 
<?php 
$zip = new ZipArchive; 
    if ($zip->open("file.zip")){ 
        $path = getcwd() . "/dirToextract/"; 
        $path = str_replace("\\","/",$path); 
        echo $path; 
        echo $zip->extractTo($path); 
        $zip->close(); 
        echo 'Done.'; 
    } else { 
        echo "Error"; 
    } 
?>

Open in new window

padas:

I accept the PHP script idea as the solution and I'll close this question out, but the code segment is generating a syntax error on the extractTo statement.  I'll open a new question.  Thanks.