diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index f9683ce0..6bcf9fd6 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -14,8 +14,10 @@ class Info_amp extends CI_Controller $this->load->model('InfoContents_model'); $this->load->model('Information_model'); $this->site_code = $this->config->item('site_code'); - //CORS TEST - header('Access-Control-Allow-Origin:*'); + //CORS + header('Access-Control-Allow-Origin:*'); + header('Access-Control-Allow-Methods:GET,PUT,POST,DELETE,OPTIONS'); + header('Access-Control-Allow-Headers:Content-Type,Authorization,Content-Length,X-Requested-With,Accept,x-csrf-token,origin'); } public function save_amp() @@ -357,5 +359,29 @@ class Info_amp extends CI_Controller ))); } } + + public function handel_word_source() { + $file = $_FILES['file']; + if (!$file) return; + //转移文件 + $path = realpath('../cht-system/views/information/word_source').'/'.basename($file['name']); + if (move_uploaded_file($file['tmp_name'], $path)) { + $msg = "File is valid, and was successfully uploaded: ".$path; + } else { + $msg = "Possible file upload attack!"; + } + + if($file) { + echo(json_encode(array( + 'status' => 'success', + 'msg' => $msg + ))); + } else { + echo(json_encode(array( + 'status' => 'error', + 'msg' => $msg + ))); + } + } }