【发布时间】:2019-10-12 18:04:11
【问题描述】:
我得到了同样的错误
数组 ([lpj] => 上传路径似乎无效。 ) 数组 ( [lpj] => 数组 ( [file_name] => lpjHIMASOS27052019140622aska-review-form-6(2).doc [upload_path] => ./dokumen/ [allowed_types] => pdf|doc|docx [max_size] = > 1000))
这是我的控制器
$lpj = 'lpj'.$this->session->userdata('id_ukm').date('dmYHis').$_FILES["lpj"]['name'];
$configlpj["lpj"]['file_name'] = $lpj;
$configlpj["lpj"]['upload_path'] = './dokumen/';
$configlpj["lpj"]['allowed_types'] = 'pdf|doc|docx'; //if your file is image
$configlpj["lpj"]['max_size'] = '1000';
$_FILES['lpj']['name'] = str_replace(' ','-',$_FILES['lpj']['name']);
$this->load->library('upload', $configlpj, 'lpj');
//Upload file sertifikat
$sertifikat = $this->session->userdata('id_ukm').date('dmYHis') . str_replace(' ','-',$_FILES["sertifikat"]['name']);
$configser["sertifikat"]['file_name'] = $sertifikat;
$configser["sertifikat"]['upload_path'] = './image/';
$configser["sertifikat"]['allowed_types'] = 'png|jpg|jpeg'; //if your file is dokumen
$configser["sertifikat"]['max_size'] = '500';
$this->load->library('upload', $configser, 'sertifikat');
//Upload Foto Penyerahan Sertifikat/Penghargaan
$penyerahan = $this->session->userdata('id_ukm').date('dmYHis') . str_replace(' ','-',$_FILES["penyerahan_penghargaan"]['name']);
$configpen["penyerahan_penghargaan"]['file_name'] = $penyerahan;
$configpen["penyerahan_penghargaan"]['upload_path'] = './image/';
$configpen["penyerahan_penghargaan"]['allowed_types'] = 'png|jpg|jpeg'; //if your file is dokumen
$configpen["penyerahan_penghargaan"]['max_size'] = '500';
$this->load->library('upload', $configpen, 'penyerahan');
$this->lpj->initialize($configlpj);
$this->sertifikat->initialize($configser);
$this->penyerahan->initialize($configpen);
if (!$this->lpj->do_upload('lpj')) {
$error = array('lpj' => $this->lpj->display_errors());
print_r($error);
print_r($configlpj);
} elseif (!$this->upload->do_upload('sertifikat')) {
$error = array('sertifikat' => $this->sertifikat->display_errors());
print_r($error);
print_r($configser);
} elseif (!$this->upload->do_upload('penyerahan_penghargaan')){
$error = array('penyerahan' => $this->penyerahan->display_errors());
print_r($error);
print_r($configpen);
有没有人可以帮帮我?
【问题讨论】:
-
你的项目目录结构是什么?
-
localhost -simkadmawa --aplication --assets --dokumen --system
-
我的意思是你试图保存文件的目录是在应用程序文件夹内部还是外部?
-
在应用程序之外
-
好像
project_folder->assets->dokumen?
标签: image file codeigniter upload