Esempio n. 1
0
 /**
  * 得到文件有真实路径
  * 
  * @access private
  * @param mixed $name
  * @return mixed
  */
 private function getRealPath($name)
 {
     $fileName_array = explode(".", strtolower($name));
     $ext = end($fileName_array);
     if ($this->nameType == 'date') {
         $date = new Date();
         return $date->format('Y/m/d/') . Crypt::md5($name) . '.' . $ext;
     } else {
         if ($this->nameType == 'hash') {
             if ($this->fileNameId != '') {
                 $num = crc32($this->fileNameId);
             } else {
                 $num = crc32($name . time());
             }
             $num = sprintf('%u', $num);
             $index = $num % 1024 . "/" . ($num >>= 10) % 1024 . "/" . ($num >>= 10) . "/" . Crypt::md5($this->fileNameId) . '.' . $ext;
             return $index;
         } else {
             $date = new Date();
             return $date->format('Y/m/d/') . $name;
         }
     }
 }