Fixed bug with incorrect mime type #183

merged 1 commit into from Dec 21, 2011


None yet

5 participants


Issue #4344.

Kohana PHP Framework member

Why would using $filename in this context cause an issue?


Because file name that will be show in the download/open file dialog is in the $download variable and it seems logical to get mime type for it. Original file may not have extension at all (especially when download is generated from the current response [Use TRUE for the filename to send the current response as the file content])


If $filename is true it uses $download for the MIME type.


Okay, I want to give the user file named "picture.jpg", but the original file stored as md5_file($file) (without extension). What mime type should be in this case?

Kohana PHP Framework member

Ah, I see... the sent filename should match the sent mime-type.

Please create an issue and reference the pull request so that this doesn't get lost. Editing the pull request to also edit the ticket gets bonus points.


@shadowhand shadowhand merged commit e6ed617 into kohana:3.2/develop Dec 21, 2011

This commit breaks the send_file functionality.

The second argument is the download name and usually doesn't exist on the file system. For example, I might serving the file:


with the download name as:


The failure comes from File::mime; It tries to load the file to find its mime type. Line 45 of kohana/file.php. This needs to be reverted.

Kohana PHP Framework member

Fixed by e139a64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment