gpt4 book ai didi

javascript - dropzone.js 文件上传超出最大请求长度

转载 作者:行者123 更新时间:2023-11-30 16:03:32 24 4
gpt4 key购买 nike

我正在使用 dropzone 并在上传大于 18MB 的文档时遇到问题。我一直收到超出最大请求长度的错误,但不明白为什么。我已经研究了几天了,但无法弄清楚。我的配置示例如下。拉我遗漏的头发。

dropzone js代码:

$("#dz-documents").dropzone({
url: "/upload/UploadDocument",
maxFiles: 1,
maxFilesize: 500.0,
addRemoveLinks: true, //*** 2/19/15 RKH *** changed
uploadMultiple: false,
autoProcessQueue: true,
paramName: links,
height: '150px',
dictResponseError: 'Error uploading file!',
init: function () {
this.on("complete", function (file) {
if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
this.removeFile(file);

// reload documents
Documents.loadDocuments($('#hdfObjectId').val(), $('#hdfRecordId').val())

Activity[0].refreshActivity($('#hdfObjectId').val(), $('#hdfRecordId').val())
}
});
}
});

C#:

[HttpPost]
public async Task<ActionResult> UploadDocument()
{
try
{
// The Name of the Upload component is "files"
if (Request.Files != null)
{
OrganizationUser user = await ApplicationUserManager.GetOrganizationUser(User.Identity.GetUserId());

// snipped validation code
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Microsoft.Azure.CloudConfigurationManager.GetSetting("avnCloudStorage"));

foreach (string name in Request.Files)
{
HttpPostedFileBase file = Request.Files[name];

if (await docRepository.Save(file, Request.Files.AllKeys, user.OrganizationID, user.ID, user.UserID.Value.ToString()))
{
return Content("Upload was successful");
}
else
{
return Content("Error occurred on upload");
}
}
}

return Content("Error occurred on upload");
}
catch (Exception ex)
{
logger.Error(ex);
throw ex;
}
}

网络配置

<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
</system.webServer>

<system.web>
<runtime executionTimeout="240" maxRequestLength="2097152">
<system.web>

最佳答案

你能试试这个 2GB max:

<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="2147483" executionTimeout="1600" requestLengthDiskThreshold="2147483647" />
</system.web>

<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
</system.webServer>

关于javascript - dropzone.js 文件上传超出最大请求长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37354111/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com