lib/private/Files/Type/Detection.php
/**
	 * detect mimetype only based on filename, content of file is not used
	 *
	 * @param string $path
	 * @return string
	 */
detect mimetype only based on filename, content of file is not used
@param string $path
@return string
detect mimetype only based on filename content of file is not used @param string $path @return string
public function detectPath($path) {
		$this->loadMappings();
		$fileName = basename($path);
		$fileName = ltrim($fileName, '.');
		if (strpos($fileName, '.') > 0) {
			$extension = strtolower(strrchr($fileName, '.'));
			$extension = substr($extension, 1); 
			return (isset($this->mimetypes[$extension]) && isset($this->mimetypes[$extension][0]))
				? $this->mimetypes[$extension][0]
				: 'application/octet-stream';
		} else {
			return 'application/octet-stream';
		}
	}
public function detectPath ( $ path ) { $ this -> loadMappings ( ) ; $ fileName = basename ( $ path ) ; $ fileName = ltrim ( $ fileName , '.' ) ; if ( strpos ( $ fileName , '.' ) > 0 ) { $ extension = strtolower ( strrchr ( $ fileName , '.' ) ) ; $ extension = substr ( $ extension , 1 ) ; return ( isset ( $ this -> mimetypes [ $ extension ] ) && isset ( $ this -> mimetypes [ $ extension ] [ 0 ] ) ) ? $ this -> mimetypes [ $ extension ] [ 0 ] : 'application/octet-stream' ; } else { return 'application/octet-stream' ; } }
detect mimetype only based on filename, content of file is not used
 @param string $path
 @return string
detect mimetype only based on filename content of file is not used @param string $path @return string
// remove leading dot on hidden files with a file extension // note: leading dot doesn't qualify as extension //try to guess the type by the file extension //remove leading .