Welcome Guest, Not a member yet? Register   Sign In
Latavish's Multiple Image Upload with Thumbnail Generation
#28

[eluser]Unknown[/eluser]
Hi I have a form with 2 text boxes and multiple files. The problem is that when I have 2 attachments The method that saves information from the text boxes running 2 times
(for each file).I know that the error comes from the cycle, but do not know how to fix it

Example:

FORM

title = TEST
desc = descript for test

file1 = test.doc
file2 = test2.doc

DB
id 1 TEST descript for test
id 2 TEST descript for test



Please help

Comments are the Bulgarian
Code:
foreach($_FILES as $key => $value)
           {

                         // Проверявам дали полетата са празни
                    if(!empty($value['name']))
                    {
                    $this->upload->initialize($config);

                    // АКО ИМА ГРЕШКИ
                if (!$this->upload->do_upload($key))
                {
                    $data['error'][$j] =  $this->upload->display_errors();
                    $j++;
                }
                else
                {
                    $this->load->model('Process_image');
                    
                   // КАЧЕНИТЕ ФАЙЛОВЕ
                    $file = $this->upload->data();
              
                $file = array('upload_data' => $this->upload->data());
               // Проверявам да ли файла е изображение
                $name = $file['upload_data']['is_image'];
        
                if(($name)){
                    // Ако е правя thumbnail
                 $this->Process_image->process_pic();

                }else{
                    //Aко не е го записвам в базата
                    //$this->Art_model->add_f();
                    //$this->Art_model->add();
                  
                }

                }
                }
                $this->Art_model->add();
                
              
        }


Messages In This Thread
Latavish's Multiple Image Upload with Thumbnail Generation - by El Forum - 01-10-2011, 01:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB