Beispiel #1
0
 /**
  * Gets a new, unused filename for the given filename and returns it with
  * the full path to the new filename.
  *
  * @param string $filename The original filename, no paths.
  *
  * @return An array, first element is the new filename, the second is the full path.
  */
 private static function _getNewNameAndPath($filename)
 {
     if (!($filesPath = Media::getFilesPath())) {
         self::$_error = 'Files directory doesn\'t exist or isn\'t writable.';
         return false;
     }
     if (!($mediaPath = Media::getMediaPath())) {
         self::$_error = 'Media directory doesn\'t exist or isn\'t writable.';
         return false;
     }
     $uploadPath = $filesPath . $mediaPath;
     $newFilename = self::_getAvailFilename($filename, $uploadPath);
     $fullPath = ROOT . $uploadPath . $newFilename;
     return array($newFilename, $fullPath);
 }