When you "upload a file" to a web server, what you are actually doing is instructing the client (browser) to open that (client) file and copy what's in it into the data stream that's being posted to the server.
When the server receives the data, it places it in a staging area where the webapp can then consume it and/or copy it into a local file.
The format of the file data, whether text, PDF,
doc, XML, or whatever, is not of interest to the webapp server file upload services themselves. Only the web application that consumes the file data has to concern itself with the data format, and it must make its own decisions. Which means that it's the application programmer's job.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.