In web.config
:
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000"/>
</webServices>
</scripting>
</system.web.extensions>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="50000000" />
</requestFiltering>
</security>
</system.webServer>
<system.web>
<httpRuntime targetFramework="4.5" maxRequestLength="50000000" executionTimeout="9999999" />
</system.web>
Мой jQuery код:
$("#btnUpload").on('click', function (e) {
e.preventDefault();
var userID = $("#hdfUserID").val();
var orderCode = $("#hdfID").val();
var orderFileType = '0';
if (UploadFile.arrayAttach.length <= 0) {
toastrDanger('Alert', 'The files have not been imported!');
return;
}
var form = $('form')[0];
var formData = new FormData(form);
$.each(UploadFile.arrayAttach, function (i, file) {
formData.append('file', file);
});
var url = 'http://localhost:59328/Esop/UploadFile?code=' + orderCode + '&userID=' + userID + '&OrderFileType=' + orderFileType
$.ajax({
url: url,
method: 'post',
data: formData,
contentType: false,
processData: false,
success: function (data) {
var res = JSON.parse(data);
if (res.State)
toastrSuccess('Alert', "Success!");
else
toastrSuccess('Alert', res.Data);
},
error: function (err) {
toastrDanger('Alert', err.statusText);
console.log(err);
}
});
})
Я искал все вопросы в переполнении стека и все еще получаю ошибку.
Нормальные файлы (текст, изображение ..) в порядке, но видеофайл вызывает HTTP 500 (Внутренняя ошибка сервера).
Мой пример файла имеет размер 26 МБ.
Я что-то пропустил ? Спасибо.