Implement content type parsing logic in the file upload handler to identify MIME types from file signatures and validate them against the allowed types list. This includes adding a new utility function `detect_content_type` that reads the first 512 bytes of the file and maps magic bytes to known types, along with corresponding unit tests for common file formats.
Implement content type parsing logic in the file upload handler to automatically detect MIME types from file signatures and validate them against an allowed list. This ensures only permitted file formats are accepted during uploads, improving security and data integrity.