Manual:Hooks/UploadVerification

From MediaWiki.org
Jump to navigation Jump to search
UploadVerification
Available from version 1.6.0
Called when a file is uploaded, to allow extra file verification to take place
Define function:
public static function onUploadVerification( $saveName, $tempName, &$error ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"UploadVerification": "MyExtensionHooks::onUploadVerification"
	}
}

For MediaWiki ≤1.25:

$wgHooks['UploadVerification'][] = 'MyExtensionHooks::onUploadVerification';
Called from:File(s): SpecialUpload.php, UploadBase.php

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

Details[edit]

  • $saveName: destination file name (string)
  • $tempName: filesystem path to the temporary file for checks (string)
  • &$error: output: HTML error to show if upload canceled by returning false (string)