Use the widget if choosing files for the override_midi or override_vorbis options.
Should be pretty straightforward. Example code can be found in MWInternalLinkAnnotationWidget. You'll want to set the namespace config option to mw.config.get( 'wgNamespaceIds' ).file too.