add function for detach trigger in upload function

This commit is contained in:
Jianxuan Li 2015-01-14 16:49:10 +08:00
parent 32806de819
commit a5e8eb8c06
1 changed files with 14 additions and 1 deletions

View File

@ -17,6 +17,7 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac
protected $serviceManager; protected $serviceManager;
protected $defaultListener = false; protected $defaultListener = false;
protected $returnInPreCheckTrigger = true;
private $uploadPath = ""; private $uploadPath = "";
private $relativePath = ""; private $relativePath = "";
@ -82,7 +83,7 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac
$results = $this->getEventManager()->trigger('upload.pre', $this, compact('file')); $results = $this->getEventManager()->trigger('upload.pre', $this, compact('file'));
if($this->defaultListener === true) if($this->returnInPreCheckTrigger === true)
{ {
$cache_data = $results->last(); $cache_data = $results->last();
@ -248,11 +249,23 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac
} }
/**
* @param $params
*/
public function setParams($params) public function setParams($params)
{ {
$this->params = $params; $this->params = $params;
} }
/**
* 强制关闭文件上传前的钩子,默认是所有上传必须执行此钩子已避免上传文件不符合规格
* 除了后台中特殊的文件操作之外不建议关闭
*/
public function forceDetachPreCheckTrigger()
{
$this->returnInPreCheckTrigger = false;
}
/** /**
* @return string * @return string
*/ */