I am using python-mosquitto to subscribe to my MQTT broker which support file type uploads. I can't figure out how to extract the file name from the header to create the received file with the same name as the sent file ?
We can't answer this.
MQTT brokers don't have any concept of "file type uploads". They only work with messages.
MQTT (v3.x) messages are just a collection of bytes so it will be entirely dependent on how what ever has published the message has chosen to encode the filename into the message along with the file content.
MQTT v3.x message headers only contain the topic the message was published to, the QOS and a 1 bit retained flag.
MQTT v5.0 added the concept of message properties in the header that could be used to store a filename, but again you would need to ask who ever is publishing the message which key they used to store the filename in a property.