Manual:Hooks/UploadForm:BeforeProcessing

From MediaWiki.org
Jump to navigation Jump to search
UploadForm:BeforeProcessing
Available from version 1.9.0
Called just before the upload data, like wpUploadDescription, are processed, so extensions get a chance to manipulate them.
Define function:
public static function onUploadForm_BeforeProcessing( SpecialUpload $uploadFormObj ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"UploadForm:BeforeProcessing": "MyExtensionHooks::onUploadFormBeforeProcessing"
	}
}

For MediaWiki ≤1.25:

$wgHooks['UploadForm:BeforeProcessing'][] = 'MyExtensionHooks::onUploadFormBeforeProcessing';
Called from:File(s): SpecialUpload.php

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

Details[edit]

  • $uploadFormObj: current SpecialUpload object

The hook function must return true (or at least something which doesn't evaluate as false). Otherwise, nothing happens, without any message to the user (unless the hook function itself takes care of that).