48 $fname, $headers = [], $sendErrors =
true, $optHeaders = [], $flags = 0
51 throw new InvalidArgumentException( __FUNCTION__ .
" given storage path '$fname'." );
57 'obResetFunc' =>
'wfResetOutputBuffers',
58 'streamMimeFunc' => [ __CLASS__,
'contentTypeFromPath' ]
62 return $streamer->stream( $headers, $sendErrors, $optHeaders, $flags );
75 $ext = strrchr( $filename,
'.' );
78 # trivial detection by file extension,
79 # used for thumbnails (thumb.php)
91 return 'unknown/unknown';
94 $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
98 $type = $magic->getMimeTypeFromExtensionOrNull(
$ext );
107 list( , $extList ) = UploadBase::splitExtensions( $filename );
109 return 'unknown/unknown';
114 return 'unknown/unknown';
117 return 'unknown/unknown';
$wgProhibitedFileExtensions
Files with these extensions will never be allowed as uploads.
$wgFileExtensions
This is the list of preferred extensions for uploading files.
$wgCheckFileExtensions
This is a flag to determine whether or not to check file extensions on upload.
$wgVerifyMimeType
Determines if the MIME type of uploaded files should be checked.
$wgStrictFileExtensions
If this is turned off, users may override the warning for files not covered by $wgFileExtensions.
$wgMimeTypeExclusions
Files with these MIME types will never be allowed as uploads if $wgVerifyMimeType is enabled.
$wgTrivialMimeDetection
Switch for trivial MIME detection.
static isStoragePath( $path)
Check if a given path is a "mwstore://" path.
Functions related to the output of file content.
Functions related to the output of file content.
static contentTypeFromPath( $filename, $safe=true)
Determine the file type of a file based on the path.
static stream( $fname, $headers=[], $sendErrors=true, $optHeaders=[], $flags=0)
Stream a file to the browser, adding all the headings and fun stuff.
if(!is_readable( $file)) $ext