【发布时间】:2017-07-19 14:48:50
【问题描述】:
我有一个包含不同输入和文件上传输入的表单。我想要用户如果他们想上传图片然后上传,但如果他们不想上传。不要报错。
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());
}
【问题讨论】:
标签: php codeigniter file-upload upload image-uploading