I have an uploader in my web page, but some people upload a file named "compañia 15% * 09.jpg" And I have a problem when the file names are like that.
I want to find a class that gives some example like this: "compania1509.jpg".
In other words, do you want to get rid of all the characters? You can use it with a pattern of [^ \ x20- \ x7e] .
name = name.replaceAll ("[^ \ \ x20 - \\ x7e]", ""); If you want to get rid of spaces, start with \ x21 instead you can restrict it to word-characters only. Use \ w to indicate "any non-word" character. The name then only matches the alphanumeric and underscores.
name = name.replaceAll ("\\ W", "");
Comments
Post a Comment