I want to upload a file into the database. While uploading I'm extracting the file name and extension. The problem now is if I have a file name which is separated by '_', it is giving me and exception "illegal characters in path "
string text = File.ReadAllText("C:\\Users\\xxxx\\Desktop\\9_file.bak", Encoding.GetEncoding(437)); byte data = File.ReadAllBytes(text); filename = Path.GetFileNameWithoutExtension(text); extension = Path.GetExtension(text); OdbcCommand Odbc2 = new OdbcCommand(); Odbc2.CommandText = "insert INTO table ( blob) VALUES (?)"; Odbc2.Parameters.AddWithValue("@blob", data); Odbc2.Connection = OdbcCon; Odbc2.ExecuteNonQuery();
Please help me to by pass the error.