這裏控制器頁面,在這裏形象的名字被插入到數據庫中,但圖像沒有進入相應的目錄這裏圖像更新數據庫,而不是在目錄
if(isset($_POST['submit']))
{
$config['upload_path'] = './upload/';
$config['allowed_types'] = 'gif|jpg|png|jpeg|pdf|mp4';
$this->load->library('upload', $config);
$this->upload->initialize($config);
$data = array
(
'student_name' => $this->input->post('dname'),
'student_email' => $this->input->post('demail'),
'student_mobile' => $this->input->post('dmobile'),
'student_address' => $this->input->post('daddress'),
'picture' => $_FILES['picture']['name']
);
}
$insertuserdata=$this->Inserts_model->form_insert($data);
這裏查看頁面
<form action="<?php echo site_url('Insert_ctrl/index/'); ?>"
method="post" enctype="multipart/form-data">
<label>NAME</label>
<input type="text" name="dname" required onkeyup="textt(this)"
id="name"><br>
<label>email</label>
<label>Picture</label>
<input class="form-control" type="file" name="picture" /><br>
<input type="submit" name="submit" value ="submit">
</form>
刪除'$ this-> upload-> initialize($ config);'line。如果您在加載類上傳遞第二個參數,則不需要使用config數組初始化類。 – Tpojka
@Tpojka因此在上傳目錄中沒有filgets –
您沒有使用上傳功能,但期望文件被上傳? – Tpojka