我的Uploadify腳本適用於大多數小於10 MB的文件。但是,一旦文件大小開始超過40 MB,它將無法上傳,只有一個錯誤消息「HTTP錯誤」。我試着爲Uploadify實現onError處理程序,但它並沒有給我提供任何具體的錯誤信息。該變量返回爲「未定義」。我檢查了我的web.config文件,並將文件大小限制設置爲50 MB,並且我有30分鐘的超時時間,所以我無法解決問題。這是我的腳本:Uploadify for ASP.NET應用程序爲大文件返回HTTP錯誤
$('#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)
{
}
});
您是否嘗試過使用調試器來查看發生了什麼?我的第一個想法確實是maxRequestLength和RequestTimeout。順便說一下,30分鐘的超時會使超時無用,這太長了! (你確定它不是30秒?) – 2013-04-24 09:39:50
maxRequestLength = 50000,RequestTimeout = 30000. 30分鐘不是不合理的。我嘗試上傳一個40 MB的文件,並花了將近12分鐘使用DSL連接。有些用戶的速度可能真的很慢,所以30分鐘的時間就是安全的。另外,當系統使用頻繁時,您需要包含系統時間。 – AndroidDev 2013-04-24 09:42:11
你是在本地運行還是在服務器上運行? – Serberuss 2013-04-24 09:43:46