diff --git a/Application/Admin/Controller/ArticleController.class.php b/Application/Admin/Controller/ArticleController.class.php index e85f25567..ba62ede5f 100644 --- a/Application/Admin/Controller/ArticleController.class.php +++ b/Application/Admin/Controller/ArticleController.class.php @@ -918,6 +918,7 @@ class ArticleController extends AdminController { if ($_POST['type'] == 1 ) { $_POST['pop_time'] = strtotime($_POST['pop_time']); } + if ($id) { $pop_rules_model = M('document_pop_rules');//M('$this->$model_name','tab_'); $res = $pop_rules_model->where(['id'=>$id])->save($_POST); @@ -949,5 +950,25 @@ class ArticleController extends AdminController { } $this->display('pop_rule_edit'); } + + public function uploadDoc() { + $id = $_REQUEST['id']; + if(@is_uploaded_file($_FILES['file']['tmp_name'])){ + $upfile = $_FILES["file"]; + + $name = $upfile["name"]; + $type = $upfile["type"]; + $size = $upfile["size"]; + $tmp_name = $upfile["tmp_name"]; + $savePath = $_SERVER['DOCUMENT_ROOT'].__ROOT__.'/Uploads/Documents/'; + move_uploaded_file($tmp_name,$savePath.$name); + $file_name = $savePath.$name; + $error=$upfile["error"];//上传后系统返回的值 + $data['document_route'] = 'Uploads/Documents/'.$name; + M('document_pop_rules')->where(['id' => $id])->save($data); + $backData['tmp'] = $file_name; + $this->ajaxReturn(json_encode($backData,TRUE)); + } + } } diff --git a/Application/Admin/View/Article/pop_rule_edit.html b/Application/Admin/View/Article/pop_rule_edit.html index 3232af106..77aeab21d 100644 --- a/Application/Admin/View/Article/pop_rule_edit.html +++ b/Application/Admin/View/Article/pop_rule_edit.html @@ -14,6 +14,22 @@ + +