Board Thread:Support Requests - Getting Technical/@comment-4572079-20140120180450/@comment-4784321-20140120180829

That is possible. MLP uses that at w:c:mlp:MediaWiki:Common.js, at the section called "Automatically add categories on Special:Upload, by Bobogoobo".

You will need to customize it a bit.