I think your custom widget should have an extra functionality to do something with the file after it is accepted. You can see some examples in the Mendix File Dropper widget (https://github.com/JelteMX/mendix-file-dropper). This widget can also be found in the Mendix App Store if you search for File Dropper.
You can either do an After commit microflow or an After commit nanoflow as shown here:
Or you can make a custom ‘On Accept’ microflow:
You will get the FileDocument as input parameter and can do anything with it.
EDIT: In case you want to know how to just save the document, you can also use the File Dropper widget to see how they do it there. You can import the widget, go to your project folder → Widgets. Find the FileDropper widget and change the .mpk to .zip. Then you can see the code of the widget and see how they do it.