|
控制器
public function updateed_tu()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if (!$this->upload->do_upload()) {
echo 'cuowu!';
} else {
$data = array('upload_data' => $this->upload->data());
$data1 = array(
'title' => $this->input->post('title'),
'userfile' => $data['upload_data']['file_name'],
);
$id = $this->input->post('id');
$this->user->gengxin('tu', $data1, $id);
$filepath = $config['upload_path'] . "/" . $data['upload_data']['file_name'];
}
redirect('admin/admin_tu');
}views中<form action="<?php echo site_url('admin/updateed_tu');?>" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="700" border="1" align="center" cellpadding="9" cellspacing="1" class='form'> <tr> <th colspan="2">修改图片</th> </tr> <tr> <td width="287" align="right">标题:</td> <td width="368"><p> <input type="text" name="title" id="title" value="<?php echo $tus[0]->title?>"/> </p></td> </tr> <tr> <td align="right">原图:</td> <td><img src="uploads/<?php echo $tus[0]->userfile?>" alt=""/></td> </tr> <tr> <td height="81" align="right">上传缩略图:</td> <td><input type="file" name="userfile" id="userfile"/></td> </tr> <tr> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="button" id="button" value="提交" /> <input type="reset" name="button2" id="button2" value="重置" /></td> </tr> </table></form>这里的model不需要。自动加载什么都做好了。但是图片修改出问题了。添加删除列出都是可以的。求大神帮我指点迷津
|
|