BackupGuard
6 years ago
Dropbox
6 years ago
Request
6 years ago
SGArchive.php
6 years ago
SGArchiveToZip.php
6 years ago
SGAuthClient.php
6 years ago
SGCallback.php
6 years ago
SGCdrEntry.php
6 years ago
SGCharsetHandler.php
6 years ago
SGDBState.php
6 years ago
SGEntry.php
6 years ago
SGFileEntry.php
6 years ago
SGFileState.php
6 years ago
SGMigrateState.php
6 years ago
SGMysqldump.php
6 years ago
SGReloadHandler.php
6 years ago
SGReloader.php
6 years ago
SGReloaderState.php
6 years ago
SGReviewManager.php
6 years ago
SGState.php
6 years ago
SGUploadHandler.php
6 years ago
SGUploadState.php
6 years ago
test.txt
6 years ago
SGUploadHandler.php
39 lines
| 1 | <?php |
| 2 | |
| 3 | namespace BackupGuard\Upload; |
| 4 | |
| 5 | class Handler |
| 6 | { |
| 7 | private $data = null; |
| 8 | private $fileName = ""; |
| 9 | private $tmpFileName = ""; |
| 10 | |
| 11 | public function __construct($data) |
| 12 | { |
| 13 | $this->data = $data; |
| 14 | $this->import(); |
| 15 | } |
| 16 | |
| 17 | private function import() |
| 18 | { |
| 19 | $this->fileName = $this->data['files']['name'][0]; |
| 20 | $this->tmpFileName = $this->data['files']['tmp_name'][0]; |
| 21 | |
| 22 | $dirPath = $this->getDestinationDirPath(); |
| 23 | $file = $dirPath.$this->fileName; |
| 24 | |
| 25 | $data = file_get_contents($this->tmpFileName); |
| 26 | file_put_contents($file, $data, FILE_APPEND); |
| 27 | } |
| 28 | |
| 29 | private function getDestinationDirPath() |
| 30 | { |
| 31 | return SG_BACKUP_DIRECTORY; |
| 32 | } |
| 33 | |
| 34 | private function getDestinationDirUrl() |
| 35 | { |
| 36 | return SG_BACKUP_DIRECTORY_URL; |
| 37 | } |
| 38 | } |
| 39 |