for checking, if a file name is valid in SharePoint, you also must prevent consecutive dots in the filename and a dot at the beginning or at the end of a filename.
Please see also here http://support.microsoft.com/kb/905231/en-us
(there is also the plus sign "+" and a starting "_" mentioned as forbidden, but that works for SharePoint file names.
These are rquirements "on top" of being a valid Windows file name.
To check for a valid windows file name, you can use
Path.GetInvalidFileNameChars()
c# code (without the dot checks)
var invalidChars = Path.GetInvalidFileNameChars();
var additionalInvalidSharePointSpecialCharacters = new char[7] { '~', '#', '%', '&', '{', '}', '+' };
invalidChars = invalidChars.Concat(additionalInvalidSharePointSpecialCharacters.AsEnumerable()).ToArray();
var failingDotsRemoved = Regex.Replace(new string(invalidCharsRemoved), @"\\.+", @".");
if (failingDotsRemoved[0].Equals('.'))
{
failingDotsRemoved = failingDotsRemoved.Substring(1);
}
if (failingDotsRemoved[failingDotsRemoved.Length - 1].Equals('.'))
{
failingDotsRemoved = failingDotsRemoved.Substring(0, failingDotsRemoved.Length - 1);
}