The best way to do this is by using a non-persistent verification entity. This can be configured within the ‘Verification before upload’ tab in the file dropper widget settings. On upload, the file dropper widget will create a verification object, set the file extension in the chosen extension attribute and will call a microflow/nanoflow in which you can verify whether the file may be uploaded or not. I recommend to use a nanoflow for this, which simply checks if the file extension is ‘txt'. The nanoflow needs to return a string as result. If the string is
empty, the file will be uploaded. If the string contains text, this will be used as an error message.
For further information, see the documentation in the widget settings, the set-up is well explained there:
Hope this helps!
One thing you can do is in the ‘Restrictions’ tab, accept only text/plain as mime type.
The other solution is do a check in the OnAcceptMicroflow as stated in the answer above.