我的控制器功能是
<?php
class Image extends CI_Controller
{
public function index()
{
$this->load->view('image');
}
public function upload()
{
$config['upload_path'] = './images/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
$this->upload->initialize($config);
if (!$this->upload->do_upload())
{
$error = array('error' =>$this->upload->display_errors());
$this->load->view('image',$error);
}
else
{
$data = array('upload_data' => $this->upload->data());
}
}
}
?>
我的观看功能是
<?php echo $error; ?>
<?php
echo form_open_multipart('image/upload'); ?>
<input name="myFile" size="40" type="file" />
<input type="submit" value="Upload" />
</form>
答案 0 :(得分:0)
这是错误的。
if (!$this->upload->do_upload())
使用如下。在do_upload()
方法
if (!$this->upload->do_upload('myFile'))