To create file validation in dapper,I was stuck about this.could anyone please help me to describe about this?
XmlReader reader = XmlReader.Create(schema "\Students.xml", settings);
while (reader.Read()) ;
if (valid)
{
writertbox("Document SCHEMA is valid");
} // end if
valid = true;
reader.Close();
CodePudding user response:
Try the below code:
string extension =
Path.GetExtension (file.FileName);
if(extension != ".xlsx" || extension !=
".xls")
{
return BadRequest();
}