Codeigniter multiupload function

94 views Asked by At

I'm tring this for 2 hours but I can't do it. I have a form where is 3 inputs (multi file). I have upload_id1, upload_id2 and upload_id3 when I upload on id1 it upload on on id1, id2 and id3 too.

for ($i = 0; $i < count($_FILES['galphoto']['name']); $i++) :

    $data = $this->upload->get_multi_upload_data($galp);

    if (!empty($data)) 
    {
        $many_image = $data[$i]['file_name']; 
        $dataphoto = array
        (
            'photo' => $many_image,
            'tours_id' => $id,
        ); 
        $this->db->insert('gallery_tours', $dataphoto);
    }
endfor;

$galp2 = 'galphoto2';
$this->upload->do_multi_upload($galp2);

for ($i = 0; $i < count($_FILES['galphoto2']['name']); $i++) :

    $data = $this->upload->get_multi_upload_data($galp2);

    if (!empty($data)) 
    {
        $many_image = $data[$i]['file_name']; 
        $dataphoto = array
        (
            'photo' => $many_image,
            'tours_id' => $id,
        ); 
        $this->db->insert('gallery_hotels', $dataphoto);
    }
endfor;

$galp3 = 'galphoto3';
$this->upload->do_multi_upload($galp3);

for ($i = 0; $i < count($_FILES['galphoto3']['name']); $i++) :

$data = $this->upload->get_multi_upload_data($galp3);

    if (!empty($data)) 
    {
        $many_image = $data[$i]['file_name']; 
        $dataphoto = array(
            'photo' => $many_image,
            'tours_id' => $id,
        );
        $this->db->insert('gallery_hostels', $dataphoto);
    }
endfor;
1

There are 1 answers

0
Nidhi On

Try to set ENVIRONMENT to development in index.php under your root directory to display your errors. Make sure your images save path is writable.

As far as I know, do_multi_upload is not built-in method in upload library of codeigniter.

But if you use this library please read proper documentation for that, its already given and also mention this in your question and update your code.