I'm using the following code to upload files:
HTML:
<form action="/Employee/FileUpload?UnityId=1&ObjectId=1" data-ajax="true" data-ajax-failure="OnFailure" data-ajax-method="Post" data-ajax-success="OnSuccess" enctype="multipart/form-data" id="form6" method="post" class="MultiFile-intercepted"><div class="card default">
<input multiple type="file" tabindex="-1" name="File" required title=" " autocomplete="off" maxlength="10" onchange="this.setCustomValidity('')" data-maxsize="10240" class="multi custom-file-input" accept=".bmp,.jpeg,.jpg,.pdf,.xls,.xlsx,.csv,.txt,.mp4,.mkv,.avi,.wmv,.mp3,.3gp,.doc,.docx">
<input id="file" name="submit" role="button" type="submit" class="btn btn-primary validate-form upload-archive" tabindex="0" value="Enviar" />
</form>
JQUERY:
$(function () {
$("#form6").submit(function (event) {
var dataString;
event.preventDefault();
var action = $("#form6").attr("action");
if ($("#form6").attr("enctype") == "multipart/form-data") {
dataString = new FormData($("#form6").get(0));
contentType = false;
processData = false;
} else {
}
$.ajax({
type: "POST",
url: action,
data: dataString,
dataType: "json",
contentType: contentType,
processData: processData,
success: function (data) {
},
error: function (jqXHR, textStatus, errorThrown) {
alert("fail");
}
});
});
});
CONTROLLER:
[HttpPost]
public ActionResult FileUpload(string ObjectId, string UnityId, HttpPostedFileBase File)
{
.. Meu código
}
With this code I am able to upload files up to 5mb, however when I try to load a 9mb code the code does not work, the controller is not even called and no error message is displayed.
Is there any limit for uploading files using this method?
How can I solve this problem?