Search code examples
codeigniter-2

How to Set or retrieve old Path image when we not update the image in the form multiple images in Codeigniter 2.2.6


I have edit form in codeigniter in that form i have 15 more image file while i update the image it updating in database but even am not update the images in the form it goes and save as null or empty path .But i need solution for that when am not update all 15 files should retrive the same old image path which it is stored in database.Please Could you guys give better solution for this.

My Edit Form

controller:

    if($this->input->post('submit'))
    {   
        if($_FILES['file']['name']!='') 
        {
            $filename = $_FILES['file']['name'];
            $file_name1 = "upload_".$this->get_random_name()."_".$filename;
            $_SESSION['file_upload']=$file_name1;
            $file ="uploads/images/".$file_name1;

        }   

        if($_FILES['file1']['name']!='') 
        {
            $filename = $_FILES['file1']['name'];
            $file_name2 =       "upload_".$this->get_random_name()."_".$filename;
            $_SESSION['file_upload']=$file_name2;
            $file ="uploads/images/".$file_name2;

        }   
        $query = $this->scener_model->popular_upload($file_name1,$file_name2)
    }

Solution

  • Finally guys i found a solution for image updating follwing some tutorials see the link "http://www.2my4edge.com/2016/04/multiple-image-upload-with-view-edit.html"

    thanks buddies who are give the logic and commenting on my post and thanks alot @ankit singh @Lll