Im working on a image uploader, what ive done so far is making uppercase to lowe and spaces to underscore... Now i want any char that isent a-z,_ or 0-9 to get deleted. I have serched php.net a bit but cant figure it out. How is it done? $file_name=strtolower($file_name); $file_name=str_replace(" ","_",$file_name); PHP:
$file_name=ereg_replace('[^a-z0-9]','',$file_name); PHP: [a-z0-9]:matches characters from a to z or from 0 to 9, [^a-z0-9]:matches characters that aren't from a to z nor from 0 to 9, the ereg_replace function removes this characters, more precisely, it changes them to '' (empty string).