首先请温柔,我是一个非常大的初学者。
好的,我正在制作一个房地产网站,我真的不知道,我尝试了几件事,但我无法让它工作。
我的问题是当我向网站添加新的房地产时,系统会生成一个唯一的 7 个字符长的数字字符串并将其插入数据库。
因此,当我上传图像时,我希望系统创建一个以这个唯一的 7 个字符长的数字字符串命名的文件夹并将图像放在那里。
这是我的控制器
<?php
class ihirdet extends CI_Controller
{
function index()
{
$this->load->view("header");
$this->form_validation->set_rules('cim', 'Cím', 'min_length[10]|max_length[100]');
$this->form_validation->set_rules('htipus', 'Hirdetés típusa', 'required');
$this->form_validation->set_rules('itipus', 'Ingatlan típusa', 'required');
$this->form_validation->set_rules('iallapot', 'Ingatlan állapota', 'required');
$this->form_validation->set_rules('jaras', 'Járás', 'required');
$this->form_validation->set_rules('telepules', 'Telepules', 'required');
$this->form_validation->set_rules('utca', 'Utca', 'required');
$this->form_validation->set_rules('hazszam', 'Házszám', 'required|numeric');
$this->form_validation->set_rules('emelet', 'Emelet', 'numeric');
$this->form_validation->set_rules('telekterulet', 'Telekterület', 'numeric');
$this->form_validation->set_rules('alapterulet', 'Alapterület', 'numeric');
$this->form_validation->set_rules('ingatlanar', 'Ingatlan ára', 'required|numeric');
$this->form_validation->set_rules('penznem', 'Pénznem', 'required');
$this->form_validation->set_rules('epitesev', 'Építés éve', 'numeric');
$this->form_validation->set_rules('szoba', 'Szoba', 'numeric');
$this->form_validation->set_rules('felszoba', 'Félszoba', 'numeric');
$this->form_validation->set_rules('futes', 'Fűtés', 'required');
//$this->form_validation->set_rules('userfile', 'Kép', 'callback_kep_ellenor');
$this->load->model('hirdetes_model');
if($this->form_validation->run() !== FAlSE)
{
$this->hirdetes_model->kuld();
// redirect(base_url() . 'elado/adatlap/' . $this->input->post('azonosito'));
} else {
$this->load->model('hirdetes_model');
$data['felh_inf'] = $this->hirdetes_model->felh_info();
$this->load->view("ihirdet_sablon", $data);
}
$this->load->view("footer");
}
}
?>
我正在测试,我只能上传一张图片并创建文件夹。
我的问题是,如何通过创建文件夹将多图像上传植入到我的索引函数中。
并且只有当图像输入有值时才创建文件夹并上传其中的图像,但是如果用户没有正确填写表格,但图像很好,仍然不要创建文件夹并且不上传图像。
请不要误解我,我不希望任何人为我编写代码,我只是希望有经验的开发人员分享他的想法,他将如何制作,没有代码只是分享想法,我会尝试自己制作.