<?php
/*
 *	www.myucms.com
 *  作者：梦雨
 *  @ QQ50361804
*/
namespace app\index\controller;
use think\Controller;
class Upload extends Controller
{
    function _initialize()
    {
        parent::_initialize();
        $this->model = model('index/up');
        
    }
    public function upimage()
    {
        $rs=checkHex($_FILES['file']['tmp_name']);
        if ($rs==5) {
            return array('code' => 0, 'msg' => '当前文件有问题不能上传');
        }
        if (!session('userid') || !session('username')) {
            $this->error('亲！请登录',url('login/index'));
        } else {
        return json($this->model->upfile('images'));
        }
    }
    public function upfile()
    {
        $rs=checkHex($_FILES['file']['tmp_name']);
        if ($rs==5) {
            return array('code' => 0, 'msg' => '当前文件有问题不能上传');
        }
        if (!session('userid') || !session('username')) {
            $this->error('亲！请登录',url('login/index'));
        } else {
        return json($this->model->upfile('files'));
        }
    }
    
 
}