/ Published in: PHP
URL: http://www.phpit.net/code/filename-safe/
Expand |
Embed | Plain Text
<?php function filename_safe($filename) { $temp = $filename; // Lower case // Replace spaces with a '_' // Loop through string $result = ''; for ($i=0; $i<strlen($temp); $i++) { $result = $result . $temp[$i]; } } // Return filename return $result; } function safe_filename ($filename) { // Definition of German Umlauts START ‘/ß/’, ‘/ä/’,'/Ä/’, ‘/ö/’,'/Ö/’, ‘/ü/’,'/Ü/’, // Definition of German Umlauts ENDE ‘([^[:alnum:]._])’ // Disallow: Not alphanumeric, dot or underscore ); $replace = array( ’ss’, ‘ae’,'Ae’, ‘oe’,'Oe’, ‘ue’,'Ue’, ‘_’ ); } ?>
You need to login to post a comment.
