using zipArchive addFile() will not add image to zip

后端 未结 4 1011
迷失自我
迷失自我 2021-01-04 14:01

I\'ve been at this for a while. This actually worked one time, then never again. it simply does not create the zip file. The file does exist.

$zip = new          


        
4条回答
  •  没有蜡笔的小新
    2021-01-04 14:14

    I had similar kind of issue and it was related with the file that I was going to add to the zip archive.

    Before adding file to zip archive, it's always better to check if the file exists.

    $thisdir = "$_SERVER[DOCUMENT_ROOT]/zip";
    if (file_exists($thisdir . "/trash-icon.png")) {
        $zip->addFile($thisdir . "/trash-icon.png", "/gabage.png");
    }
    

提交回复
热议问题