How can I configure additional mime types in Phoenix

Hello there .
I am working on a Phoenix project and trying to configure support for additional file types in my config.exs. I want to be able to upload .m4a .flac files. How can i do this in config.exs


`  Expected a file extension with a known MIME type.

  MIME types can be extended in your application configuration as follows:

  config :mime, :types, %{
    "application/vnd.api+json" => ["json-api"]
  }

  Got:

  "m4a"`

by the way the suggestion made above does not solve the problem.

My understanding is that in the config snippet above, application/vnd.api+json is the MIME type, and ā€œjson-apiā€ is the extension. To be honest I donā€™t really know what ā€œjson-apiā€ is supposed to be; doesnā€™t look like an extension.

Adding something like this to your config/config.ex might do the trick:

config :mime, :types, %{
    "audio/mp4" => ["m4a"],
    "audio/flac" => ["flac"]
  }
1 Like

let me try this

thanks :blush: