This is a browser limitation. You can only POST file objects when sending data with fetch
or XMLHttpRequest
but that means you have to submit your form asynchronously.
When we want to submit files along with the classic form post we run into a serious browser limitation. The file input field is the only field available to submit files to a server but its value cannot be set. The file input field value can only be modified by the user by manually adding files (in one action).
To work around this you can use the File Encode plugin, which encodes the files as base64 data strings and sends those to the server.
Submitting forms with very large base64 encoded strings can result in browsers running out of memory (especially on mobile devices). Server side security software might also tag a big form post as insecure and prevent the submit from succeeding.