Good morning Friends next
I have a mvc web system with C # and need to upload multiple files simultaneously. Until then, okay, but when the files have a big name of the problem I'll exemplify.
I have 5000 xmls to import with the name "NFe35160870940994008196550100004554491586403310.xml"
When I select 10 to 20 files all go to the controler, now above that goes null.
Now when I change the file name to "A" by getting A (1), A (2) ... send it to the controler up to 2000 at a time.
I do not know what to do, increase maxRequestLength to the maximum
Follow the code that I use CSHTML
@using (Html.BeginForm("ImportarXML", "LeituraNfe", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<div class="col-md-12">
<div class="col-md-4">
<label>Selecione arquivos para importação</label><br />
<input type="file" multiple="multiple" name="postedFilesBases" />
</div>
<div class="col-md-2">
<label></label><br />
<input type="submit" value="Importar" class="btn btn-primary btn-sm" />
</div>
</div>
}
Controller
public ActionResult ImportarXML(List<HttpPostedFileBase> postedFilesBases)
{
try
{
var h = new List<XmlDocument>();
foreach (var item in postedFilesBases)
{
var document = new XmlDocument();
document.Load(item.InputStream);
h.Add(document);
}
postedFilesBases.Clear();
foreach (var item in h)
{
//Faça algo
}
}
cath(Exception ex)
{
//erro
}
}