我試圖做一個多文件上傳,其中一個input['file']
是形象,另外一個是視頻笨多個上傳至2個不同的文件夾
這裏控制器
public function upload(){
$data['errorPic'] = $this->validateUpload();
$data['errorVid'] = $this->validateUpload2();
}
public function validateUpload(){
if ($_FILES AND isset($_FILES['coverImage']['name'])){
$config['upload_path'] = 'blogpics/';
$config['allowed_types'] = 'png|gif|jpg|jpeg';
$config['max_size'] = '999999';
$this->load->library("upload",$config);
if(!$this->upload->do_upload("coverImage")){
return $this->upload->display_errors();
}
}
}
public function validateUpload2(){
if ($_FILES AND isset($_FILES['video']['name'])){
$config['upload_path'] = 'blogvids/';
$config['allowed_types'] = 'png|gif|jpg|jpeg';
$config['max_size'] = '999999';
$this->load->library("upload",$config);
if(!$this->upload->do_upload("video")){
return $this->upload->display_errors();
}
}
}
只有第一被稱爲是工作
例如功能: 如果我把第一個validateUpload2()
功能上validateUpload()
函數的頂部,頂部的第一個功能是工作的第二上e沒有
所以我可以做什麼可能的解決辦法上傳?謝謝! – user1033600