我有一个查询来上传文件。该文件是xlsx / xlsx /(ms.excel)文件扩展名。我不知道该在哪里放置“允许文件类型”。
如果无法输入xlsx / xls /(ms excel扩展名)非文件文件 请帮助
std::bind
答案 0 :(得分:0)
尝试这样上传多个文件
根据您的目录添加路径
for ($i=0; $i < $jumlah; $i++) {
$file_name = $_FILES['userfile']['name'][$i];
$file_upload[$i] = '';
if($file_name != ''){
$_FILES['userfile']['name']= $_FILES['userfile']['name'][$i];
$_FILES['userfile']['type']= $_FILES['userfile']['type'][$i];
$_FILES['userfile']['tmp_name']= $_FILES['userfile']['tmp_name'][$i];
$_FILES['userfile']['error']= $_FILES['userfile']['error'][$i];
$_FILES['userfile']['size']= $_FILES['userfile']['size'][$i];
$config['upload_path'] = '.file/file_PTM/'.$new_file_name;
$config['allowed_types'] = 'xlsx|csv|xls';
$config['max_size'] = 1000;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$this->load->library('upload', $config);
if(!$this->upload->do_upload('userfile')){
//image uploading error
}else{
$data = $this->upload->data();
$file_name = $data['file_name'];
$ekstensi = pathinfo($file_name, PATHINFO_EXTENSION);
$explode = explode('.',$file_name);
$bulan = date('M');
$tahun = date('y') ;
$kode = $this->session->userdata('kode_puskesmas');
$new_file_name =$explode[1].'_'.$kode.'_'.$bulan.$tahun.'.'.$ekstensi;
}
}
}