Depending on your Mendix version you could manipulate the widget after it has been rendered. I tested the below it does seem to adjust the behavior
wid.restrictions="zip;json;txt"
wid.params.restrictions="zip;json;txt";
wid._allowedExts=["zip","json","txt"];
You could construct this code from some context object, that should make it dynamic