CodeIgniter 4 get_mime_by_extension |
09-27-2021, 10:56 PM
(This post was last modified: 09-27-2021, 10:57 PM by objecttothis. Edit Reason: clarity )
https://codeigniter.com/userguide3/helpe..._extension
Did this not get ported over from CI3? I checked here: https://codeigniter4.github.io/CodeIgnit...elper.html and here: https://codeigniter4.github.io/CodeIgnit...pload.html I searched this forum and google. It's in the context of this code: PHP Code: $this->output->set_content_type(get_mime_by_extension($thumb_path)); I think needs to become something like this: PHP Code: $this->response->setContentType(get_mime_by_extension($thumb_path)); Am I correct that that the equivalent to set_output() is setBody from the Message Class? That also wasn't clear here: https://codeigniter4.github.io/CodeIgnit...the-output
CI3 User Guide says "This is not an accurate way of determining file MIME types, and is here strictly for convenience. It should not be used for security purposes."
Maybe that's why CI4 doesn't have get_mime_by_extension(). If you must use it, it is a simple function. You can copy it from CI3 by yourself.
(09-28-2021, 12:32 AM)kenjis Wrote: CI3 User Guide says "This is not an accurate way of determining file MIME types, and is here strictly for convenience. It should not be used for security purposes." Yeah, I saw that. I'll create a github issue for the technical debt in our repo. Any thoughts on the question about set_output()? "Am I correct that that the equivalent to set_output() is setBody from the Message Class? That also wasn't clear here: https://codeigniter4.github.io/CodeIgnit...the-output"
You are correct on the setBody.
SEE: HTTPResponses. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |