Beispiel #1
0
 function zip()
 {
     $ftp = $this->container->get('ftp');
     $dir = $this->getParameter('dir', '/');
     $parent = $this->getParameter('path', '/');
     $folder = $this->getParameter('folder', '');
     $file = $this->getParameter('file', '');
     $save_filename = $this->getParameter('save_filename', '');
     $current = rtrim($parent, '/') . '/' . ltrim($dir, '/');
     $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current, 'folder' => $folder, 'file' => $file, 'save_filename' => $save_filename));
     // TODO::임시파일이름 지정
     $temp_file = tempnam(sys_get_temp_dir(), 'Zip');
     $model = new \App\Models\Ftp($ftp);
     $zip = $model->zip($current, $folder, $file, $temp_file);
     $this->debug($temp_file);
     $upfile['tmp_name'] = $temp_file;
     $upfile['name'] = rtrim($save_filename, '.zip') . '.zip';
     $model->upload($current, $upfile);
     $this->debug($upfile);
 }
Beispiel #2
0
 function upload()
 {
     $this->debug($_GET);
     $this->debug($_POST);
     $this->debug($_FILES);
     $config = $this->container->get('config');
     $ftp = $this->container->get('ftp');
     $dir = $this->getParameter('dir', '/');
     $parent = $this->getParameter('path', '/');
     $current = rtrim($parent, '/') . '/' . ltrim($dir, '/');
     $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current));
     // $this->debug ( $_FILES ['file'] );
     $upload = new \Kaiser\Plupload($config->get('plupload'));
     $upload->no_cache_headers();
     $upload->cors_headers();
     if (($file = $upload->getFiles()) !== false) {
         $model = new \App\Models\Ftp($ftp);
         $model->upload($current, $file);
     } else {
         $this->err($upload->get_error_message());
     }
 }