Manual:Hooks/FileUpload

From MediaWiki.org
Jump to: navigation, search
FileUpload
Available from version 1.11.0
Fires when a local file upload occurs.
Define function:
public static function onFileUpload( $file ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"FileUpload": [
			"MyExtensionHooks::onFileUpload"
		]
	}
}

For MediaWiki ≤1.25:

$wgHooks['FileUpload'][] = 'MyExtensionHooks::onFileUpload';
Called from: File(s): LocalFile.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:FileUpload extensions.

Details[edit]

$file - The LocalFile object.

The return value of this hook is ignored.