diff --git a/src/Zip.php b/src/Zip.php index 3b00341..f31b4cf 100644 --- a/src/Zip.php +++ b/src/Zip.php @@ -237,7 +237,10 @@ public function zip_end() { // add each file foreach ($this->org_files as $org_file_path) { // get file name from the path - $name = substr($org_file_path,strrpos($org_file_path,"/")+1); + //dont remove first char of filename if no path is specified + if( strpos($org_file_path, "/") !== false ){ + $name = substr($org_file_path,strrpos($org_file_path,"/")+1); + } // add the file to the archive $lib->addFile($org_file_path,$name); } @@ -493,4 +496,4 @@ private function path() { return join(DIRECTORY_SEPARATOR, func_get_args()); } -} \ No newline at end of file +}