For some reason when using
$this->response->send_file($file_to_send, $file->hashed_name.'.'.$file->extension);
I get errors like this:
ErrorException [ Warning ]: mime_content_type() [<a href='function.mime-content-type'>function.mime-content-type</a>]: can only process string or stream arguments
SYSPATH/classes/kohana/file.php [ 52 ]
47 }
48
49 if (ini_get('mime_magic.magicfile') AND function_exists('mime_content_type'))
50 {
51 // The mime_content_type function is only useful with a magic file
52 return mime_content_type($filename);
53 }
Trace shows that mime_content_type(arguments)
seems to be bool FALSE
for some reason.
However I pass to send_file
normal string full path like /var/www/dev3/media_files/files/113b778d9751e7d1667b300557b6e8030ba1227e68ef9c4dd093a4cd79691f9d.png
.
I've checked Kohana system files and it turned out that I can pass mime_type manualy as an option, so this works perfectly:
$this->response->send_file($file_to_send, $file->name.'.'.$file->extension, array('mime_type' => File::mime_by_ext($file->extension)));
However, standard $this->response->send_file($file_to_send)
does not work for me.