| @@ 57-69 (lines=13) @@ | ||
| 54 | * |
|
| 55 | * @return false|null |
|
| 56 | */ |
|
| 57 | public function addFile($filepath, $newfilename = null) |
|
| 58 | { |
|
| 59 | // Read in the file's contents |
|
| 60 | $fp = @fopen($filepath, "r"); |
|
| 61 | if ($fp === false) { |
|
| 62 | return false; |
|
| 63 | } |
|
| 64 | $data = fread($fp, filesize($filepath)); |
|
| 65 | fclose($fp); |
|
| 66 | $filename = (isset($newfilename) && trim($newfilename) != '') ? trim($newfilename) : $filepath; |
|
| 67 | $result = $this->archiver->addFile($data, $filename, filemtime($filename)); |
|
| 68 | return $result; |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * Add Binary File |
|
| @@ 79-91 (lines=13) @@ | ||
| 76 | * |
|
| 77 | * @return false|null |
|
| 78 | */ |
|
| 79 | public function addBinaryFile($filepath, $newfilename = null) |
|
| 80 | { |
|
| 81 | // Read in the file's contents |
|
| 82 | $fp = @fopen($filepath, "rb"); |
|
| 83 | if ($fp === false) { |
|
| 84 | return false; |
|
| 85 | } |
|
| 86 | $data = fread($fp, filesize($filepath)); |
|
| 87 | fclose($fp); |
|
| 88 | $filename = (isset($newfilename) && trim($newfilename) != '') ? trim($newfilename) : $filepath; |
|
| 89 | $result = $this->archiver->addFile($data, $filename, filemtime($filename)); |
|
| 90 | return $result; |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * Add File Data |
|