Manual:Hooks/UploadForm:BeforeProcessing

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": "MediaWiki\\Extension\\MyExtension\\Hooks::onUploadFormBeforeProcessing"
	}
}
Called from: File(s): specials/SpecialUpload.php
Interface: UploadForm_BeforeProcessingHook.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).