У меня есть форма, которая отлично работает, но изображения всегда регистрируются с "1" в базе данных. на самом деле база данных изображений "image_name.jpg" или "image_name.png" должна быть сохранена с.
Где я ошибся? Это мой контроллер;
public function send_Basvur_message(){
$config['upload_path'] = './panel/uploads/basvur_v/';
$config['allowed_types'] = 'jpg|png';
$config['max_size'] = 4096;
$config['overwrite'] = false;
$config['encrypt_name'] = false;
$config['remove_space'] = true;
$this->load->library('upload', $config);
$this->upload->initialize($config);
$this->load->library("form_validation");
$this->load->model("Basvur_model");
$this->form_validation->set_rules("name", "Ad", "trim|required");
$this->form_validation->set_rules("email", "E-posta", "trim|required|valid_email");
$this->form_validation->set_rules("subject", "Konu", "trim|required");
$this->form_validation->set_rules("message", "Mesaj", "trim|required");
$this->form_validation->set_rules("img_url", "img_url");
$this->form_validation->set_rules("captcha", "Doğrulama Kodu", "trim|required");
if($this->form_validation->run() === FALSE) {
// TODO Alert...
$this->session->set_flashdata('info','Action Completed');
redirect(base_url("basvuru"));
} else {
$insert = $this->Basvur_model->add(
array(
"name" => $this->input->post("name"),
"email" => $this->input->post("email"),
"message" => $this->input->post("message"),
"subject" => $this->input->post("subject"),
"img_url" => $this->upload->do_upload("img_url"),
"created_at" => date("Y-m-d H:i:s")
)
);
if($this->session->userdata("captcha") == $this->input->post("captcha")){
$name = $this->input->post("name");
$email = $this->input->post("email");
$subject = $this->input->post("subject");
$message = $this->input->post("message");
$img_url = $this->input->post("img_url");
$email_message = "{$name} isimli ziyaretçi. Başvuru Yaptı <br><b>Mesaj : </b> {$message} <br> <b>E-posta : </b> {$email}";
if(send_email("", "Yeni Aday başvurusu | $subject", $email_message)){
$this->session->set_flashdata('success','Action Completed');
redirect(base_url("basvuru"));
// TODO Alert..
} else {
$this->session->set_flashdata('success','Action Completed');
redirect(base_url("basvuru"));
// TODO Alert..
}
} else {
//başarısıs
$this->session->set_flashdata('error','Action Not Completed');
redirect(base_url("basvuru"));
}
}
}