From a5e8eb8c0626acd8068dd4eecaf40eb1a6ba75df Mon Sep 17 00:00:00 2001 From: Jianxuan Li Date: Wed, 14 Jan 2015 16:49:10 +0800 Subject: [PATCH] add function for detach trigger in upload function --- Westdc/File/Upload.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Westdc/File/Upload.php b/Westdc/File/Upload.php index 3045758..a7f3c23 100644 --- a/Westdc/File/Upload.php +++ b/Westdc/File/Upload.php @@ -17,6 +17,7 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac protected $serviceManager; protected $defaultListener = false; + protected $returnInPreCheckTrigger = true; private $uploadPath = ""; private $relativePath = ""; @@ -82,7 +83,7 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac $results = $this->getEventManager()->trigger('upload.pre', $this, compact('file')); - if($this->defaultListener === true) + if($this->returnInPreCheckTrigger === true) { $cache_data = $results->last(); @@ -248,11 +249,23 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac } + /** + * @param $params + */ public function setParams($params) { $this->params = $params; } + /** + * 强制关闭文件上传前的钩子,默认是所有上传必须执行此钩子已避免上传文件不符合规格 + * 除了后台中特殊的文件操作之外不建议关闭 + */ + public function forceDetachPreCheckTrigger() + { + $this->returnInPreCheckTrigger = false; + } + /** * @return string */