UploadFile::getExt PHP Méthode

getExt() private méthode

+---------------------------------------------------------- 取得上传文件的后缀 +---------------------------------------------------------- +----------------------------------------------------------
private getExt ( string $filename ) : boolean
$filename string 文件名 +----------------------------------------------------------
Résultat boolean +----------------------------------------------------------
    private function getExt($filename)
    {
        $pathinfo = pathinfo($filename);
        return $pathinfo['extension'];
    }

Usage Example

 static function multiUpload($files, $destination = null, $name = null)
 {
     $result = array();
     if (self::isMultiFile($files)) {
         $arrayFiles = self::normalizeArray($files);
         $i = 0;
         foreach ($arrayFiles as $value) {
             $tmp = new UploadFile($value);
             if ($destination !== null) {
                 $tmp->setDestination($destination);
             }
             if ($name !== null) {
                 $tmp->setName($name);
             }
             $tmp->upload();
             $cod = $tmp->getError();
             $errMsg = $tmp->getError_message();
             $arrayRes = array($cod, $errMsg, $tmp->getDestination(), $tmp->getName() . '.' . $tmp->getExt(), $value['name']);
             array_push($result, $arrayRes);
         }
     } else {
         $tmp = new UploadFile($files);
         if ($destination !== null) {
             $tmp->setDestination($destination);
         }
         if ($name !== null) {
             $tmp->setName($name);
         }
         $tmp->upload();
         $cod = $tmp->getError();
         $errMsg = $tmp->getError_message();
         $arrayRes = array($cod, $errMsg, $tmp->getDestination(), $tmp->getName() . '.' . $tmp->getExt(), $value['name']);
         array_push($result, $arrayRes);
     }
     return $result;
 }
All Usage Examples Of UploadFile::getExt