Jump to content

Recommended Posts

I previously had this working, but now it's not.  Can someone give me a suggestion as to why it gives me  zip_close() expects parameter 1 to be resource, object given in /home/crescen9/public_html/uploadsongs.php on line 91

 

I haven't changed anything on this page except for the str_replace function, and it create the folder albums/albums/. etc.  But, it doesn't create the zip archive here is the code.

 

$zipobject = new ZipArchive(); 
$newbandname = @str_replace("&#39","'",$_SESSION['bandname']);
$archivedir = "albums/albums/".$newbandname.$_SESSION['idno']."/";
if (!is_dir($archivedir)){
@mkdir($archivedir);
}
$archivename = $newbandname."_".$_SESSION['cdtitle'].".zip";
if ($zipobject->open($archivedir.$archivename, ZIPARCHIVE::CREATE) !== TRUE) {
    die ("Could not open archive");
}
$n = 1;
$x = $_SESSION['numtracks'];
$directory = "radio/".$newbandname.$_SESSION['idno']."/";
while ($n <= $x){
$filename[$n] = $_SESSION['songs'][$n];
$zipobject-> addFile($directory.$filename[$n], $newbandname."_".$_SESSION['cdtitle']."/".$filename[$n]);
$n++;
}
zip_close($zipobject);

 

Thanks for any help you can provide.

Link to comment
https://forums.phpfreaks.com/topic/140439-solved-zip-file-help/
Share on other sites

Where did you get the ziparchive class?

 

Look for a method or property of the class that returns the ziparchive resource and call that inside the zip_close, or even maybe a close method of the ziparchive class and just call that instead of invoking the zip_close function.

Link to comment
https://forums.phpfreaks.com/topic/140439-solved-zip-file-help/#findComment-735012
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.