我有一個包含不同輸入和文件上傳輸入的表單。我想要用戶,如果他們想上傳圖片然後上傳,但如果他們不想上傳。不要給出錯誤。Codeigniter上傳圖片選擇
if($_POST){
$config['upload_path'] = 'images/tmp';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 2048;
$config['min_width'] = 480;
$config['min_height'] = 360;
$this->load->library('upload', $config);
if (!$this->upload->do_upload('userfile')) {
$error = array('error' => $this->upload->display_errors());
//Sending this $error to view and if a user didnt upload image and just filled
//the other inputs it shows error. but i dont want that.
} else { }
} else {
redirect(site_url());
}
是的它沒關係,但其他錯誤如允許的類型如何。我想要顯示的只是圖像沒有上傳錯誤。 – codeigniter