Exemplo n.º 1
0
 /**
  * 取得application根目錄的路徑
  * @param {String} 底下的目錄
  * @return {String} 修正後的目錄路徑
  */
 function get_root_path($path = NULL)
 {
     $filepath = __FILE__;
     $needle = "application";
     $index_dir = substr($filepath, 0, strpos($filepath, $needle));
     if (!is_null($path)) {
         $first_word = substr($path, 0, 1);
         if ($first_word == "\\" || $first_word == "/") {
             $path = substr($path, 1);
         }
         $path = format_dir_separator($path);
         $index_dir = $index_dir . $path;
     }
     return $index_dir;
 }
 /**
  * 取得完成下載的路徑
  * @return string
  */
 public function get_completed_dir()
 {
     $convert_files = $this->CI->config->item("convert_files");
     $dir_path = $convert_files["completed"];
     $dir_path = format_dir_separator($dir_path);
     if (substr($dir_path, -1) != DIRECTORY_SEPARATOR) {
         $dir_path = $dir_path . DIRECTORY_SEPARATOR;
     }
     $base_path = $this->get_base_path();
     $full_path = $base_path . $dir_path;
     return $full_path;
 }
Exemplo n.º 3
0
 /**
  * 取得檔案路徑
  * @return string 檔案路徑
  */
 public function get_path()
 {
     $internal_name = $this->get_field('internal_name');
     $type = $this->get_field("type");
     $dir_path = $this->CI->config->item("upload_path");
     if ($type != "uploaded") {
         $convert_files = $this->CI->config->item("convert_files");
         $dir_path = $convert_files["completed"];
     }
     $dir_path = format_dir_separator($dir_path);
     if (substr($dir_path, -1) != DIRECTORY_SEPARATOR) {
         $dir_path = $dir_path . DIRECTORY_SEPARATOR;
     }
     $needle = 'application';
     $base_path = substr(__DIR__, 0, strpos(__DIR__, $needle));
     $full_path = $base_path . $dir_path . $internal_name;
     return $full_path;
 }