<?php
/*
 +----------------------------------------------------------------------
 | TEMMOKUMVC [ NO BEST , ONLY BETTER ]
 +----------------------------------------------------------------------
 | Copyright (c) 2018~2019 https://www.temmoku.cn All rights reserved.
 +----------------------------------------------------------------------
 | Author: 张宗强 Email:webmaster@temmoku.cn QQ:158726877 516669373 TEL:17895221001 微信:temmokumvc
 +---------------------------------------------------------------------- 
*/
namespace user\Controller;
use \Temmoku\Controller;
use \Temmoku\Lib\UploadFiles;
class Upfile extends Controller{
	public function up(){
		//允许跨源
		header("Access-Control-Allow-Origin: *");
		!isset($_POST['mid']) && $_POST['mid']=0;
		!isset($_POST['filename']) && $filename='file';
		$ModelDB_Setting=[];
		if($_POST['mid'] && (!defined('P_MODULE') || !defined('M_MODULE'))){
			$ModelDB_Setting=unserialize(C('home|home_ModelDB.'.$_POST['mid'])['setting']);
			$ModelDB_Setting=$ModelDB_Setting[$_POST['keys']];
		}
		//判断是不是缩略图
		$_GET['thumb'] ? $thumb=true : $thumb=false;
		echo (new UploadFiles)->Upload_Star($ModelDB_Setting,$filename,$thumb,'json');
	}
}
?>