From 1f5e43bb7b7f863ec8a4c992060f5d265db95bc7 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 3 Aug 2011 11:25:48 -0400 Subject: [PATCH] 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. --- airtime_mvc/application/controllers/ApiController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index e81469fa9..d54f292ac 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -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));