Using XDocument.load in a loop to read all Xml in a folder i get only the first file.
What i wrong?
in a page (webform) i allow user to upload multiple xml with a button
with another button user can save on db files selected
if i select just one file it works well but if i select multiple file only the first will be saved.
so to test the code il simple print the document on page and i saw that
with multiple selection the first file is printed two times if i select two files and so on.
IEnumerable<string> filesUploaded = Directory.EnumerateFiles(Server.MapPath("~/SFA_XML_Upload/"), "*")
.Select(f => Path.GetFileName(f));
int ordcliRowsInserted = 0;
foreach (var file in filesUploaded)
{
string filename = Server.MapPath("~/SFA_XML_Upload/" + file);
var doc = XDocument.Load(filename);
Response.Write(doc.ToString());
//ordcliRowsInserted += SaveDataBaseOrdcli(ReadOrdcli(doc, filename));
}