Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Fixed bug with incorrect mime type #183

merged 1 commit into from

5 participants


Issue #4344.


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?


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

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.

Fixed by e139a64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 26, 2011
  1. Fixed bug with incorrect mime type

    Spider authored
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  classes/kohana/response.php
2  classes/kohana/response.php
@@ -446,7 +446,7 @@ public function send_file($filename, $download = NULL, array $options = NULL)
if ( ! isset($mime))
// Get the mime type
- $mime = File::mime($filename);
+ $mime = File::mime($download);
// Open the file for reading
Something went wrong with that request. Please try again.