0
我試圖在頁面中顯示我上傳的圖像。我使用dropzone上傳圖片。使用codeigniter從上傳文件夾中顯示圖像php
控制器:
public function do_uploadlogo($id){
$restologo=$_POST['restologo'];
$tempFile = $_FILES['file']['tmp_name'];
$fileName = $_FILES['file']['name'];
$targetPath = getcwd() . '/uploads/restaurants/logos/';
$targetFile = $targetPath . $fileName ;
$data = array(
'restologo' => 'uploads/restaurants/logos/'.$fileName
);
$this->load->database('findiningcebu');
$this->db->where('id', $id);
$this->db->update('restaurants',$data);
move_uploaded_file($tempFile, $targetFile);
}
public function addrestologolink($id){
$data = array(
"action" => base_url('/index.php/AdminController/do_uploadlogo/'.$id),
"data" => $this->db->get_where('restaurants',array('id'=>$id))
);
$this->load->view('admin/logo',$data);
}
查看
<div class="del" style="padding-left: 15px">Current Logo:</div>
<div class="del" style="padding-left: 15px"><img src="<?=base_url().$restologo?>" /></div>
請幫幫忙!
哪裏是restologo變量addrestologolink方法您的數據數組中?我認爲你需要通過restologo變量。 – umefarooq
您是否在控制檯中看到錯誤,或圖片是否顯示? –
我沒有收到任何錯誤。圖像不會顯示。該怎麼辦? – QueenR