Hi guys.
Right i have already spent the best part of 8 hours trying to get this working.
What i am trying to do:
Upload zip file to directory. Check if upload is successfull and then unzip to directory created by name of zip file.
I can upload the zip file and create the diectory but the damn files wont unzip to the newly created directory:(
$folderName = substr($_FILES['Filedata']['name'],0,-4);
$folderPath="D:/www/htdocs/triplej/media/shoots/images/";
if(move_uploaded_file($_FILES['Filedata']['tmp_name'], $folderPath.$_FILES['Filedata']['name'])){
$zip = zip_open($folderPath.$_FILES['Filedata']['name']);
mkdir($folderPath.$folderName);
if($zip !== false) {
while ($zip_entry = zip_read($zip)) {
if (zip_entry_open($zip, $zip_entry, "r")) {
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
$fp = fopen($folderPath.$folderName."/","w");
fwrite($fp,$buf);
zip_entry_close($zip_entry);
}
echo "
";
}
}
}else {
echo "zip file could not be found!";
}
i keep on getting this error
Warning: fopen(D:/www/htdocs/triplej/media/shoots/images/pictest/): failed to open stream: Permission denied
But yet if i change
($folderPath.$folderName."/","w");
//to
($folderPath. zip_entry_name($zip_entry)."/","w");
It upzips the images to the images folder and not the newly created folder. In testing the zip file is called pictest.zip and the folder created is pictest.
thanks for any help on this.
Paul