|
开发环境xamp,window7
点击上传后,var_dump($this->upload->data());打印出来没有任何数据,也没有提示任何错误,这是什么情况?
打印出来的结果是:
array(14) { | | ["file_name"]=> | | string(0) "" | | ["file_type"]=> | | string(0) "" | | ["file_path"]=> | | string(0) "" | | ["full_path"]=> | | string(0) "" | | ["raw_name"]=> | | string(0) "" | | ["orig_name"]=> | | string(0) "" | | ["client_name"]=> | | string(0) "" | | ["file_ext"]=> | | string(0) "" | | ["file_size"]=> | | string(0) "" | | ["is_image"]=> | | bool(false) | | ["image_width"]=> | | string(0) "" | | ["image_height"]=> | | string(0) "" | | ["image_type"]=> | | string(0) "" | | ["image_size_str"]=> | | string(0) "" | | } |
下面是代码,求各位大神帮帮小弟...
以下是test.php
PHP复制代码 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Test extends CI_Controller {
public function index ()
{
$this->load->view('file.html');
}
public function upload (){
$this->load->library('upload');
$copnfig['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|png|jpg|jpeg';
$this->load->library('upload',$config);
$this->upload->do_upload('pic');
var_dump($this->upload->data());
}
}
?> 复制代码
以下是file.html
HTML复制代码 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>上传测试 </title>
</head>
<body>
<form action="<?php echo site_url('test/upload');?>" method="post" enctype="multipart/form-data">
<input type="file" name="pic"/>
<input type="submit" value="上传"/>
</form>
</body>
</html> 复制代码
|
|