Esempio n. 1
0
 /**
  * Update file path - change file extension taken from MIME information.
  *
  * @return boolean
  */
 protected function updatePathByMIME()
 {
     $result = parent::updatePathByMIME();
     if ($result && !$this->isURL()) {
         list($path, ) = $this->getLocalPath();
         $newExtension = $this->getExtensionByMIME();
         $pathinfo = pathinfo($path);
         if ($newExtension !== $pathinfo['extension']) {
             $newPath = \Includes\Utils\FileManager::getUniquePath($pathinfo['dirname'], $pathinfo['filename'] . '.' . $newExtension);
             $result = rename($path, $newPath);
             if ($result) {
                 $this->path = basename($newPath);
             }
         }
     }
     return $result;
 }
Esempio n. 2
0
 /**
  * Update file path - change file extension taken from MIME information.
  *
  * @return boolean
  */
 protected function updatePathByMIME()
 {
     $result = parent::updatePathByMIME();
     if ($result && !$this->isURL()) {
         list($path, $isTempFile) = $this->getLocalPath();
         $newExtension = $this->getExtensionByMIME();
         $pathinfo = pathinfo($path);
         $newPath = $pathinfo['dirname'] . LC_DS . $pathinfo['filename'] . '.' . $newExtension;
         $result = rename($path, $newPath);
         if ($result) {
             $this->path = basename($newPath);
         }
     }
     return $result;
 }