CC-2634: Downloading a file with a non-ASCI name, doesn't

show up those chars

- removed pathinfo() call and manually parsing the basefile name.
This commit is contained in:
James 2011-08-03 11:25:48 -04:00
parent 104e1cd289
commit 83432e1996

View file

@ -103,8 +103,14 @@ class ApiController extends Zend_Controller_Action
//We just want the basename which is the file name with the path
//information stripped away. We are using Content-Disposition to specify
//to the browser what name the file should be saved as.
$path_parts = pathinfo($media->getPropelOrm()->getDbFilepath());
header('Content-Disposition: attachment; filename="'.$path_parts['basename'].'"');
//
// By james.moon:
// I'm removing pathinfo() since it strips away UTF-8 characters.
// Using manualy parsing
$full_path = $media->getPropelOrm()->getDbFilepath();
$file_base_name = strrchr($full_path, '/');
$file_base_name = substr($file_base_name, 1);
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
}
header("Content-Length: " . filesize($filepath));