您好,我使用Codeigniter一次上傳3張圖片,我可以成功上傳,但我不知道如何從3張圖片中獲取網址(我只能從最後一張圖片獲取網址。)(我想插入3張圖片URL數據庫)Codeigniter 3 - 我可以從3張圖片中獲取圖片上傳的網址嗎?
這裏是我的代碼
控制器
public function add_event()
{
$config['upload_path'] = 'images/location';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 2048;
$config['max_width'] = 2000;
$config['max_height'] = 1500;
$this->load->library('upload', $config);
$this->upload->do_upload('userfile');
$this->upload->do_upload('userfile2');
$this->upload->do_upload('userfile3');
$data_upl = array('upload_data' => $this->upload->data());
$this->load->view('admin/success', $data_upl);
}
myuploadform視圖
<?php echo form_open_multipart('admin/add_event') ?>
pic1
<input type="file" name="userfile" size="20" />
pic2
<input type="file" name="userfile2" size="20" />
pic3
<input type="file" name="userfile3" size="20" />
<input type="submit" value="upload"/>
<?php echo form_close(); ?>
我SUC cess頁面視圖(我想回顯3頁圖片的網址!但我只得到1個網址最後的圖像)(其實我想插入到數據庫)
<h1>Successfully Add</h1>
<ul>
<li><?php echo $upload_data['full_path'];?></li>
</ul>