Esempio n. 1
0
 /**
  * 处理上传
  *
  * @access public
  */
 public function process()
 {
     $param = Request::only('authkey', 'args');
     $config = @unserialize(base64url_decode($param['args']));
     $uploadObject = new UploadManager();
     if (!$uploadObject->setParam($config)->checkUploadToken($param['authkey'])) {
         return abort(500);
     }
     $file = Request::file('file');
     $returnFileUrl = $uploadObject->setFile($file)->upload();
     if (!$returnFileUrl) {
         return abort(500);
     }
     $this->saveFile($returnFileUrl, $file);
     return response()->json(['file' => implode('|', $returnFileUrl)]);
 }
 /**
  * 处理上传
  */
 public function process()
 {
     $parpams = Request::only('authkey', 'args');
     $config = @unserialize(base64url_decode($parpams['args']));
     //检测请求是否合法
     $uploadObject = new UploadManager();
     if (!$uploadObject->setParam($config)->checkUploadToken($parpams['authkey'])) {
         return abort(500);
     }
     //开始处理上传
     $file = Request::file('file');
     $returnFileUrl = $uploadObject->setFile($file)->upload();
     if (!$returnFileUrl) {
         return abort(500);
     }
     return response()->json(['file' => $returnFileUrl]);
 }