Ir al contenido principal
Develop Tools
← Volver a la guía de uso

How to check Content-Type by searching for MIME type and extension

When handling files with a web server or API, do not decide the format based on the extension alone, but also check the MIME type, actual data, and content-type at the time of delivery.

Flow of searching for an extension or MIME type and checking usage and Content-Type setting examples
Flow of searching for an extension or MIME type and checking usage and Content-Type setting examples

When this guide is useful

This is for users who want to check the list of MIME types, how to check Content-Type from the extension, the uses of application/json and image/webp, and the formats allowed for file uploads.

  • Find out why Nginx, Apache, or CDN returns an incorrect Content-Type
  • Check the media type of JSON, CSV, PDF, and images returned by the API
  • Design file upload accept attributes and server-side validation
  • Save

When to check the MIME type

  • When checking the Content-Type settings of the web server or CDN
  • When designing file upload permission formats
  • When checking the media type of email attachments or API responses
  • Isolating the cause of the mismatch between the extension and browser display/download behavior

Steps to find MIME type and extension

  1. Enter the extension, MIME type, or usage in the search field.
  2. Narrow down your search by category and registration status, and check candidate uses and typical extensions.
  3. Open details to see example HTTP headers, compressibility, character/binary handling, and safety precautions.
  4. Copy
  5. Check the actual response headers and file contents and test whether they are treated as intended.

Notes on not relying only on extensions

Since the file name extension and Content-Type can be changed by the user, upload verification does not rely only on the MIME type, but also checks the file signature, decoding capability, capacity, storage destination, and Content-Disposition at the time of delivery.

Displaying user-uploaded HTML or SVG from the same origin as is may lead to script execution. In addition to checking the format, consider sanitization and alternate origin distribution.

Specific example: Check the reason why WebP images are downloaded

If you open a WebP image URL and it is downloaded instead of displayed, the server may be returning something like application/octet-stream instead of image/webp.

Check the recommended MIME type by searching for .webp in the list, and check the actual Content-Type and Content-Disposition in the Network field of the developer tools.

  1. Enter .webp in the search field and open the image/webp details.
  2. Check the headers of the target response in your browser's developer tools.
  3. Modify the MIME mapping of your server or CDN to image/webp.
  4. Refresh the cache and recheck image display and download behavior.

Even if you modify the Content-Type, the old CDN cache may remain. Please also check the Age and cache key of the response.

Frequently asked questions

If the extensions are the same, will the MIME type be determined as one?
Additional information: IANA
Can you determine whether a file is safe just by its MIME type?
Save

Probar en el navegador

Los datos introducidos se procesan en el navegador. Conserve los datos originales y revise el resultado antes de guardarlo o compartirlo.

Open MIME type list/extension search tool