public function addAppdetails()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('appname', 'App Name', 'required');
$this->form_validation->set_rules('platform', 'Platform', 'required');
//$this->form_validation->set_rules('category','App Category','required');
$this->form_validation->set_rules('description', 'App Description', 'required');
//$this->form_validation->set_rules('app_pic','App Pic','required');
//$this->form_validation->set_rules('file','App File','required');
if ($this->form_validation->run()) {
$appname = $this->input->post('appname');
$platform = $this->input->post('platform');
$category1 = $this->input->post('category');
$descripton = $this->input->post('description');
$category = implode(",", $category1);
$data = array('name' => $appname, 'platform' => $platform, 'description' => $descripton, 'category' => $category);
$this->appImageupload();
die;
$this->Dev_model->addApp($data);
} else {
$data['dataArray'] = $this->sessionStart();
$category = $this->input->post('category');
print_r($category);
$this->load->view('dev/addApp', $data);
}
}
public function appImageupload()
{
$config['upload_path'] = './uploads/appImages';
$config['allowed_types'] = 'exe';
$config['file_type'] = 'exe';
$config['max_size'] = 1000000000;
$this->load->library('upload', $config);
if ( ! $this->upload->appImageUpload('app_pic'))
{
$error = array('error' => $this->upload->display_errors());
print_r($error);
}
else
{
$data = array('upload_data' => $this->upload->data());
return $data;
}
}
appImageupoad功能用于上传' .exe'文件。因此,每当我尝试上传可执行文件时,都会出错。但是,如果我将$config['allowed-type]
更改为.jpg或任何图像文件扩展名,则会上传。
P.S.I也在do_upload()中尝试了同样的事情,它给出了同样的错误。
答案 0 :(得分:0)
您也可以删除这些代码行
$config['file_type'] = 'exe';
$config['max_size'] = 1000000000;
您已指定允许的类型allowed_types
尝试一下,如果有效,那么您也可以应用其他验证