Search code examples
phpmodel-view-controllerheadermime

questions on header in MVC


In an MVC framework, responsible for defining the header would be the controller or view?

Imagining a situation to download a file, there would be rendering the content, so I imagine that the controller would set the appropriate header to download, correct?

Another point is that I have doubts regarding the mimes ... by default we use text / html; charset = UTF-8, the other would be to set the mime type of file to download, is this correct?


Solution

    1. Correct, controller should "decide" which is the appropriate header
    2. Content-type is the header you want to change.