0

在我下面的代码中,创建文件夹时似乎没有上传图像,但是如果我返回并刷新上一页并使用创建的文件夹再次尝试上传图像,

我是否必须将上传的内容移动到is_dir if statement文件夹中,但是在已经创建文件夹的情况下会发生什么?else?

$conceptOne = 'conceptOne';
        $conceptTwo = 'conceptTwo';

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

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


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

        }else{

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

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

            print_r($config);

          if(!$this->upload->do_upload($conceptOne)) { #= try upload

            $data['uploadError'] = array('uploadError' => $this->upload->display_errors()); #Error

            $this->load->view('layout', $data);

      } // Do upload
          else{
            $data = array('upload_data' => $this->upload->data($conceptOne));

          }// end else
        }// end if folde
4

1 回答 1

1

删除上面的else

//Set File Settings 

这样它下面的块就不再处于那种状态了。

于 2012-04-11T03:57:36.753 回答