Jump to content

extract a file from zip file


homer.favenir

Recommended Posts

i cant find where my file go...:(

 

$file = "AG3421226.WDB09.02.010.pdf";
$zip = new ZipArchive;
$res = $zip->open('\\\\asecasiagsd\\AGS\\AGS\\WIP\\PROOF_QA_CSR\\AG3421226.WDB09.02.010.zip');
if ($res === TRUE) {
    $zip->extractTo('\\\\asecasiagsd\\AGS\\AGS\\WIP\\PROOF_QA_CSR\\extract', $file);
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}

Link to comment
Share on other sites

Everything looks ok -- however, I'm wondering if these routines work ok with the windows file share?  Can you try mapping a drive on the server and specifying the drive letter instead?

 

It also might be  a permissions or path issue.  Are you using IIS or Apache?  Can you create a simple file in that same directory using fopen() fwrite() fclose(), and see if that works ok?

Link to comment
Share on other sites

Personally, windows is suppossed to accept either \ or / as path seperators.  Just to remove any confusion I would only use the slash, so you don't have to be concerned about the escape property. 

 

With that said, if the code is not returning any error conditions, then my only suggestion is that the extracto path requires the ending slash.  My suggestion would be to change your code so that it only uses the slash characters: so the extracTo method call would be:

 

 

$zip->extractTo('//asecasiagsd/AGS/AGS/WIP/PROOF_QA_CSR/extract/', $file);

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.