다른 지역 이름으로 업로드하는 여러 파일에 문제가 있으며 업로드하기 전에 모든 영역 파일 이름을 변경하고 싶습니다.다른 지역 이름을 가진 여러 코드로 업로드하고 업로드하기 전에 파일의 이름 바꾸기
이것은 HTML 형식입니다. 사진이 디렉토리에 업로드됩니다
<input type="file" placeholder="" name="profilPic"/>
<input type="file" placeholder="" name="topPic"/>
이
컨트롤러$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 100;
$config['max_width'] = 1024;
$config['max_height'] = 768;
//$config['file_name'] = $this->session->sersession["id"];
$this->load->library('upload', $config);
$profilPic = $this->upload->do_upload('profilPic');
if (!$profilPic){
$error = array('error' => $this->upload->display_errors());
$this->session->set_flashdata("error", "profil pic was not uploaded= ");
}else{
$data = array('upload_data' => $this->upload->data());
$this->session->set_flashdata("success", "profil picture was uploaded.");
}
$topPic = $this->upload->do_upload('topPic');
if (!$topPic){
$error = array('error' => $this->upload->display_errors());
$this->session->set_flashdata("error", "top pic was not uploaded");
}else{
$data = array('upload_data' => $this->upload->data());
$this->session->set_flashdata("success", "this picture was uploaded.");
}
주입니다. 두 번째 파일 업로드는 물론
$this->upload->initialize($config);
을 사용하기 전에하지만 난 당신은 또한, 이전에 "userID_profil.jpg"그리고 당신은 $config['file_name']
을 설정할 수 있습니다