Re: formatting a filename
| From: | mhe at ruc dot dk | Date: | Thu, 05 Sep 2002 14:00:39 +0000 |
| Subject: | Re: formatting a filename | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115308@lists.php.net to get a copy of this message | ||
Here is a function that is used in the My_eGallery modules for PHP nuke.
function find_nom_dif($nom)
{
$nom=stripslashes($nom);
$nom=str_replace("'","",$nom);
$nom=str_replace("\"","",$nom);
$nom=str_replace("\"","",$nom);
$nom=str_replace("&","",$nom);
$nom=str_replace(",","",$nom);
$nom=str_replace(";","",$nom);
$nom=str_replace("/","",$nom);
$nom=str_replace("\\","",$nom);
$nom=str_replace("`","",$nom);
$nom=str_replace("<","",$nom);
$nom=str_replace(">","",$nom);
$nom=str_replace(" ","_",$nom);
$nom=str_replace(":","",$nom);
$nom=str_replace("*","",$nom);
$nom=str_replace("|","",$nom);
$nom=str_replace("?","",$nom);
$nom=str_replace("é","e",$nom);
$nom=str_replace("è","e",$nom);
$nom=str_replace("ç","c",$nom);
$nom=str_replace("@","",$nom);
$nom=str_replace("â","a",$nom);
$nom=str_replace("ê","e",$nom);
$nom=str_replace("î","i",$nom);
$nom=str_replace("ô","o",$nom);
$nom=str_replace("û","u",$nom);
$nom=str_replace("ù","u",$nom);
$nom=str_replace("à","a",$nom);
$nom=str_replace("!","",$nom);
$nom=str_replace("§","",$nom);
$nom=str_replace("+","",$nom);
$nom=str_replace("^","",$nom);
$nom=str_replace("(","",$nom);
$nom=str_replace(")","",$nom);
$nom=str_replace("#","",$nom);
$nom=str_replace("=","",$nom);
$nom=str_replace("$","",$nom);
$nom=str_replace("%","",$nom);
$nom=str_replace("ä","ae",$nom);
$nom=str_replace("Ä","Ae",$nom);
$nom=str_replace("ö","oe",$nom);
$nom=str_replace("Ö","Oe",$nom);
$nom=str_replace("ü","ue",$nom);
$nom=str_replace("Ü","Ue",$nom);
$nom=str_replace("ß","ss",$nom);
return $nom;
}
/Martin
Citat Javier Montserat <codareef@hotmail.com>:
> i want to format the filename of an uploaded file as follows :-
>
> -- replace blankspace with "_"
>
> -- remove any illegal characters.
>
> Which string functions should I use to do this?
>
> Thanks,
>
> Javier
>
>
>
> _________________________________________________________________
> Join the worlds largest e-mail service with MSN Hotmail.
> http://www.hotmail.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
mvh
Martin Hjort Eriksen
Studenterrådet, Roskilde Universitetscenter