Am 20.08.2010 23:10, schrieb Wang, Mary Y:
Hi, our solution for storing uploaded files in database/filesystem with php uses utf-8 for the filenames in the database in combination with string-replacement for some special characters in php. These are in our case the german "Umlaute" (ä,ö,ü,ß), because otherwise we get the problem of strange translations of these characters (php uses utf-8, german windows uses cp-1250), that made them unusable for download-links. You can use the function below, just add your special characters to the $trans-array. As another benefit this function returns unique filenames that can be used for storing the files in a target-directory. <SNIP> public static function get_unique_file_name($target_dir, $current_file_name){ $trans = array ("ä" => "ae", "ö" => "oe", "ü" => "ue", "ß" => "ss", "Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue"); target_file_name = strtr($current_file_name, $trans); $i = 0; $old_target_file_name = $target_file_name; while(file_exists($target_dir . '/' . $target_file_name)){ $i++; $target_file_name = $i . $old_target_file_name; } return $target_file_name; } </SNIP> Ludwig |