我的CI是2.0的,CI控制器部分代码
function up() { //print_r($_FILES['userfile']['tmp_name']);exit;在这里可以取到上传内容
$uid = get_cookie('user_id');
if ($uid) {
$this->load->model('Usermodel');
$path = $_SERVER["DOCUMENT_ROOT"] . "/upfiles/photo/" . $uid;
if (!file_exists($path)) {
mkdir($path, 0777);
}
$config['upload_path'] = $path;
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '1000000';
$config['max_width'] = '6000';
$config['max_height'] = '6000';
$config['encrypt_name'] = 'true';
$this->load->library('upload', $config);
if (!$this->upload->do_upload()) {
echo $error = $this->upload->display_errors();//然后走到这里报错You did not select a file to upload.
} else {
$this->load->library('image_lib');
|