Welcome Guest, Not a member yet? Register   Sign In
Keep upload data in memory on a multiple step form [SOLVED]
#1

[eluser]Ludovic-r[/eluser]
Hi !

I've a little question about keeping in memory the upload data when we have a multiple form, let me explain :

I have a single field to upload my image (linked to a function called do_upload) then when it's uploaded I have a form with several fields (like title, description) linked to another function called add_infos

Until here it's okay when I fill the fields with informations and put "submit" it works very well BUT when I miss a field it shows some errors like "hey you miss the title field" and reload the page and I loose my upload data informations

How can I store in memory the upload data informations and send them into my second function (add_infos) to not lost them when the page is reloaded if there are some errors.

I've tried session but it doesn't seems to work.

IT would be very very apprecited if you could help me because I've tried many things like set_value, session etc and I've read almost the entire posts of this forum. MANY THANKS !

Here's my code :

Code:
function add_infos()
    {    
        
        $this->load->library('form_validation');
        $this->form_validation->set_rules('title', 'title', 'required|xss_clean|encode_php_tags');
        $this->form_validation->set_rules('description', 'description', 'required|trim|xss_clean|encode_php_tags');
        $this->form_validation->set_rules('alt', 'alt', 'required|trim|xss_clean|encode_php_tags');

        
                        if ($this->form_validation->run() == FALSE)
                        {    
                            $this->load->view('upload/upload_part2');
                        }
                        else
                        {store informations in my DB

And the do_upload function :

Code:
function do_upload() { ...my code... then if it's okay :
                            $data = array(
                                'upload_data' => $this->upload->data(),
                                );
                                
                            $this->load->view('upload/upload_part2', $data);    
                        }
}


Messages In This Thread
Keep upload data in memory on a multiple step form [SOLVED] - by El Forum - 10-24-2010, 07:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB