I use this static function
in c# on uploading a file to replace invalid file names by using RegEx
:
static string removeBadChar(string filename)
{
// Replace invalid characters with "_" char.
return Regex.Replace(filename, @"[^\w\.-]", "_");
}
And the File Name.csv
is replaced with File_Name.csv
But I have another problem, if the file name of CSV expects these keyboard letters : é, è, à, ù, ì, ò
the web application faults.
How can I resolve this?.