Jump to content

PHP unlink error - can't delete folder extracted from zip.


centenial

Recommended Posts

Hi,

 

I'm using PHP's ZipArchive class to extract a ZIP file to a temporary folder. I run a task on the files in that folder. Then I want to delete the folder.

 

The problem is that I can't delete the folder created by the zip - I'm given this error:

 

[05-Jun-2009 12:35:08] PHP Warning:  unlink(upload) [<a href='function.unlink'>function.unlink</a>]: Permission denied in unzip.php

 

This is my code - any idea what I'm doing wrong?

 

<?php

$zip = new ZipArchive;
$res = $zip->open('upload.zip');

if ($res === TRUE)
{
$zip->extractTo('upload');
$zip->close();

        // do stuff here

unlink('upload');
}

?>

 

I even tried adding this before I extract the zip:

 

mkdir('upload',0777);

 

That didn't work. So I tried this before I unlink the folder.

 

chmod('upload',0777);

 

That didn't work either. Any ideas?

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.