4

我的 Uploadify 脚本适用于大多数小于 10 MB 的文件。但是一旦文件大小开始超过 40 MB,它将无法上传,只有“HTTP 错误”的错误消息。我尝试为 Uploadify 实现 onError 处理程序,但它没有给我任何详细信息,确切的错误是什么。变量返回“未定义”。我检查了我的 web.config 文件,文件大小限制设置为 50 MB,我的超时时间为 30 分钟,所以我不知道问题出在哪里。这是我的脚本:

$('#uploader').uploadify({
  'uploader': '/js/uploadify/uploadify.swf',
  'script': '/cms/common/uploadify/UploadHandler.ashx',
  'cancelImg': '/images/cancel_upload.png',
  'buttonImg': '/images/select_video_thumbnail_en-us.gif',
  'auto': true,
  'folder': '/Temp',
  'multi': false,
  'sizeLimit': 0,
  'displayData': 'percentage',
  'simUploadLimit': 1,
  'fileExt': '*.jpg;*.gif;*.png',
  'fileDesc': '*.jpg;*.gif;*.png',
  'buttonText': 'Select thumbnail...',
  'width': '120',
  'height': '24',
  'onComplete': function (e, queueId, fileObj, response, data)
  {
    return true;
  },
  'onError': function (a, b, c, d)
  {
    if (d.status == 404)
      alert('Could not find upload script.');
    else if (d.type === "HTTP")
      alert('error ' + d.type + ": " + d.status);
    else if (d.type === "File Size")
      alert(c.name + ' ' + d.type + ' Limit: ' + Math.round(d.sizeLimit / 1024) + 'KB');
    else
      alert('error ' + d.type + ": " + d.text);
  },
  'onCancel': function (e, queueId, fileObj, data)
  {

  }
});
4

2 回答 2

3

我正在运行的 IIS7 的默认内部文件大小限制为 30 MB。将 maxRequestLength 设置为大于此值将无济于事。通过将以下内容添加到您的 web.config 文件中,可以解决该问题:

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

这也可以在 IIS7 中设置。有关更多详细信息,请参阅以下链接: IIS7 文件上传大小限制 在 IIS 7 中启用请求过滤

于 2013-04-24T10:28:59.903 回答
0

在您的 uploadify 函数中添加以下标签。

'sizeLimit': '10045728'

它会为你工作。大小限制是您的文件大小限制。它以 KB 为单位。

于 2013-04-24T10:19:27.273 回答