I've a input file
control where I can upload any kind
of file.
So, I'm getting the file and storing in a FormData
and making an ajax call
to my controller.
It is working fine with Images and small .mp3 files.
But when I'm uploading .mp3 files more than 5MB, it is going to the error function
My code goes like this :
document.getElementById('fileUploadControl').onchange = function () {
var data = new FormData();
var files = $("#fileUploadControl").get(0).files;
for (var i = 0; i < files.length; i++) {
data.append("UploadedImage" + i, files[i]);
}
var ajaxRequest = $.ajax({
url: '/Main/BroadcastFileUpload/',
data: data,
cache: false,
contentType: false,
processData: false,
type: "POST",
success: LoadImages,
error: OnLogoFail
});
ajaxRequest.done(function (xhr, textStatus) {
});
};
<input type="file" multiple id="fileUploadControl" style="width:0px;height:0px" />
Can anyone help me with this?
Yeah...I found the solution.Thanks to @artm
I've changed the maxRequestLength
in web.config
<httpRuntime targetFramework="4.5" maxRequestLength="2097151" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With