コード例 #1
0
ファイル: Upload.php プロジェクト: narensgh/asset-server
 public function move($postdata)
 {
     if (!$postdata && !isset($postdata['filepath']) && !isset($postdata['destination'])) {
         throw new Exception("invalid input", '500');
     }
     $adapter = new Http();
     $adapter->addFilter('File\\Rename', array('target' => $postdata['destination'], 'use_upload_extension' => true, 'overwrite' => true));
     try {
         if ($adapter->receive()) {
             $file = $adapter->getFilter('File\\Rename')->getFile();
             echo $file[0]['target'];
         } else {
             throw new \Exception('Unable to upload file', '500');
         }
     } catch (\Exception $ex) {
         throw new \Exception($ex->getMessage(), '500');
     }
 }