The uploadcorrupt message, "The file is corrupt or has an incorrect extension. Please check the file and upload again." is vague and confusing and commonly leads to support requests:
It can be generated when either:
- MimeMagic detected unknown/unknown but extension is listed as "recognizable", or
- MimeMagic detected a type which was different to the type suggested by the extension.
The details of why the upload was rejected are logged in exquisite detail to the debug log, but the user doesn't get to see any of that. Some users (presumably Windows users from the post Win 95 era) don't really understand file extensions and are easily confused by talk about them. Sometimes the error is the fault of the external detection utility and extra details need to be provided for debugging.
- Splitting messages for the unknown/unknown case from the "different MIME type" case
- Mapping the most common file extensions and the most common MIME types to a set of localised messages, so that we can talk about e.g. "JPEG" instead of "image/jpeg" and ".jpg".
- Providing the detected type, the file extension, and the type that the file extension implies, as message parameters.