Hi Dan,
Sorry for the late reply. I do have Decoding and Encoding for my file attachments. What i was trying to do was, when the user tries to upload a file with a file name more than 128 characters. I wanted to trim the file name before it gets pushed to the library. Please see my code below
private string CleanFileName(string filename)
{
string invalidCharacters = "[\\~#%&*{}/:<>?|\"-]";
Regex invalidCharactersRegex = new Regex(invalidCharacters);
filename = Regex.Replace(invalidCharactersRegex.Replace(filename, ""), @"\s+", "");
if (filename.Length > 128)
{
filename = string.Format("{0}.{1}",Path.GetFileNameWithoutExtension(filename).Substring(0, 128), Path.GetExtension(filename));
}
return filename;
}
Not sure what i am doing wrong here.
Look forward to hear from you.
Regards,
Ravi