0

mkdir関数内でif(is_dir)機能していないのに、その上で1行だけで機能しているのはなぜですか?

mkdir($location.$folderName, 0777);

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

            }else{

            //Set File Settings 
              $config['upload_path'] = $location.$folderName; 
              $config['allowed_types'] = 'jpg|png|pdf'; 
              $config['file_name'] = $folderName.'_'.$concept;
              $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 folder
4

2 に答える 2

1

あなたのコードはそれ自体と矛盾しています...あなたは呼び出しmkdir ( $location . $folderName, 0777 );ていますが、これを確実にチェックし! is_dir ( $folderName ))ても機能しません

試す

$location  = "" ; // Your Location 
$foldername = "" ; // Your Folder Name
$path = $location . DIRECTORY_SEPARATOR . $foldername ;

if (!is_dir ( $path )) {

    if(is_writable($location))
    {
        mkdir ($path, 0777 );
    }
    else
    {
        die("You don't have permission to create folder");
    }
}

 else {
于 2012-04-11T01:53:48.127 に答える
0

これを試して :

if (!(file_exists($folderName))) {
于 2012-04-11T01:31:06.447 に答える