0

私は以下のコードを持っていますが、複数あるためにアップロードエラーをどのように行うことができるかわかりません$this->do_upload

        $location = $_SERVER['DOCUMENT_ROOT'].'/_assets/quote/uploads/';

        $folderName = $this->quote->getCompanyDetails()->companyName;
        $folderName = str_replace(" ", "_", $folderName);
        $folderName = strtolower($folderName);

        $concepts = array('conceptOne','conceptTwo');
        $logo = $folderName.'_logo';

        if(!is_dir($location.$folderName))
        {   
            mkdir($location.$folderName);
            chmod($location.$folderName, 0777);
        }

        //Set File Settings 
          $config['upload_path'] = $location.$folderName; 
          $config['allowed_types'] = 'jpg|png|pdf'; 
          $config['remove_spaces'] = TRUE;
          $config['overwrite'] = TRUE;
          $config['max_size'] = '1024'; 
          $config['max_width'] = '1024'; 
          $config['max_height'] = '768'; 

          $this->load->library('upload', $config);

        // Upload Concepts

        foreach($concepts as $concept)
        {
             $config['file_name'] = $concept;
             $this->upload->initialize($config);
             $this->upload->do_upload($concept);
        }

        //Upload Logo

            $config['file_name'] = $logo;
             $this->upload->initialize($config);
             $this->upload->do_upload('logo');
4

1 に答える 1

1
 // Upload Concepts
    foreach($concepts as $concept)
    {
         $config['file_name'] = $concept;
         $this->upload->initialize($config);
         if ( ! $this->upload->do_upload($concept))
         {
           $error = array('error' => $this->upload->display_errors());
           break;
         }
    }
于 2012-04-11T20:58:36.580 に答える