php - $zip->addFile on my Server doesn't create folders but only file path -


usually following script create , fill zip archive works properly, both on localhost , on other servers:

$zip = new ziparchive(); $zip->open($filename, ziparchive::create);  foreach( $pathtoassets $npath ) {      $files = new recursiveiteratoriterator(         new recursivedirectoryiterator( $npath ), recursiveiteratoriterator::leaves_only      );      foreach ($files $name => $file) {          if( $file->getfilename() != '.' && $file->getfilename() != '..' ) {             $filepath = $file->getrealpath();                    $temp = explode("/", $name);             array_shift( $temp );             $nname = implode("/", $temp);             $zip->addfile($filepath, $nname);         }      } }  $zip->close() 

but in new server script instead of creating folders, subfolders , files, creates files name "folder\subfolder\file.extension"

for example: instead of creating css folder bootstrap subfolder contains style.css file, creates file name 'css\bootstrap\style.css'

i can not figure out take action on server change behavior. have suggestions me?

thanks

method addfile() adds file archive, doesn't create missing directories.

to create directory structure inside archive use method addemptydir()


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -