moving files around
Posted: Fri Sep 23, 2005 4:12 pm
I have this zip file, and I want to extract it to a certain directory, say c:\myzippedfiles, So I found the unzip code but I don't know how to make it so that it will unzip into a directory other than the directory that the code executing the commands is in, so basically, I upload the zip file to c:\myzippedfiles but the code i have creates the files in my htdocs folder.
Thanx in advance.
Thanx in advance.
Code: Select all
$zip = zip_open($zipfile);
if ($zip) {
while ($zip_entry = zip_read($zip)) {
$fp = fopen(zip_entry_name($zip_entry), "w");
if (zip_entry_open($zip, $zip_entry, "r")) {
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
fwrite($fp,"$buf");
zip_entry_close($zip_entry);
fclose($fp);
}
}
zip_close($zip);
}