Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to add MIME types to your OpenCart store

This guide shows you how to allow more file types in OpenCart, for example when an upload fails with a "file type" error.

Online Stores2 min read13 steps

What is a MIME type?

A MIME type is a label that tells software what kind of file it is. For example, image/png is a PNG picture and application/pdf is a PDF. OpenCart is free software for running an online shop. It only accepts uploads whose labels are on its allowed list. If a type is missing, the upload fails.

Before you start

Only allow types you really need. Never allow script types like PHP. A bad file could harm your shop. Take a backup first.

These steps follow OpenCart 3. Menus in other versions may differ a little.

Steps

  1. Log in to your OpenCart admin panel.
  2. Click System, then Settings.
  3. Click Edit next to your store.
  4. Open the Server tab.
  5. Scroll to File Upload.
  6. Find Allowed File Extensions. Add the extension on a new line, such as zip.
  7. Find Allowed File Mime Types. Add the matching MIME type on a new line, such as application/zip.
  8. Click Save.
  9. Try your upload again.

Each entry goes on its own line.

Common examples

FileExtensionMIME type
PDFpdfapplication/pdf
ZIPzipapplication/zip
Worddocxapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
Texttxttext/plain
WebP imagewebpimage/webp

If it still fails

  1. Check the file size. The server has an upload size limit. Ask Hostvento support to check it.
  2. Make sure the extension and the MIME type both appear on the lists.
  3. Clear your browser cache and try again.
  4. Check that the image or download folder can be written to. Ask support if you are unsure about folder permissions.

Serving new file types from the web server

Sometimes browsers will not open a file type because the web server lacks its label. On Apache, you can fix this in .htaccess. Take a copy of the file first, then add a line like this:

AddType application/json .json

This tells Apache to label all .json files as JSON.

Tip: Newer OpenCart versions keep the upload settings in a similar place. Look in the settings for the word "Upload".

Quick recap

  • MIME types are labels for file types.
  • Add the extension and MIME type under System, Settings, Server.
  • Only allow safe types, and never allow PHP.
  • Check file size limits if uploads still fail.