Manual:Hooks/UploadVerification

From Linux Web Expert

UploadVerification
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
<translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 520329)</tvar></translate>
Called when a file is uploaded, to allow extra layers of verification for a file to take place
<translate> Define function:</translate>
public static function onUploadVerification( string $saveName, string $tempName, string &$error ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"UploadVerification": "MediaWiki\\Extension\\MyExtension\\Hooks::onUploadVerification"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> upload/UploadBase.php
<translate> Interface:</translate> UploadVerificationHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:UploadVerification extensions</tvar>.</translate>


Details

  • $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)