I have the following form:
@using (Html.BeginForm("importCSV", "Administrador", FormMethod.Post, new { @id = "upldFrm", @enctype = "multipart/form-data" }))
{
<input id="file" name="file" type="file" />
<label style="color:red; white-space: pre-line">@ViewBag.Message</label>
}
<script>
$(function () {
$("#file").change(function () {
$("#upldFrm").submit();
});
});
</script>
When I send any file ( .csv
, .jpg
, .txt
, and others) it works perfectly, but when I try to send a file like: Arquivo 16.03.15.rar
it does not even arrive in the action, it generates the image error below .
The goal is to only allow upload .csv
files, but I can not let problems happen like this. Can anyone help me?