I'm using this code to force download files:
$ftitle is utf8 string that is retreived from mysql table, it is may be english, arabic ...etc depend on the filename field stored in that location.Code:switch( $file_extension ) { case "pdf": $ctype="application/pdf"; break; case "exe": $ctype="application/octet-stream"; break; case "zip": $ctype="application/zip"; break; case "rar": $ctype="application/rar"; break; case "doc": $ctype="application/msword"; break; case "xls": $ctype="application/vnd.ms-excel"; break; case "ppt": $ctype="application/vnd.ms-powerpoint"; break; case "gif": $ctype="image/gif"; break; case "png": $ctype="image/png"; break; case "jpeg": case "jpg": $ctype="image/jpg"; break; default: $ctype="application/force-download"; } header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header("Content-Type: $ctype; charset: UTF-8;"); header("Content-Disposition: attachment; filename=".$ftitle.";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); readfile("$filename"); exit();
the problem is the name (that appear in save dialog) is ok when it is english, but when it is arabic it is appear with strange chars like ظٹط©
I did try to use utf8_encode($ftitle) but the same problem.
thank's in advance




Reply With Quote