开源的swfupload上传插件做压力测试出现问题
由于项目需要上传大文件,考虑到灵活性和美观性选择了开源的swfupload上传插件,但是在做压力测试时发现了问题用LoadRunner单独对上传做压力测试,并发10个用户没有延时,每个用户操作5次,上传完成时理论上文件夹下面应该有50个文件,但实际上只有30多个,并且每次测试丢失文件数目不定。
如果单个用户上传文件完全没有问题。
<p>aspx</p><p><%@ Page Language="C#" AutoEventWireup="true" CodeBehind="swfupload.aspx.cs" Inherits="EAPF.WebForm.swfupload" %></p><p><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>">
<html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>">
<head id="Head1" runat="server">
<title>DemoUpload</title>
<link href="<%= ResolveUrl("~/Content/css/style.css")%>" rel="stylesheet" type="text/css" />
<link href="<%= ResolveUrl("~/Content/css/upload.css")%>" rel="stylesheet" type="text/css" /></p><p> <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/swf/swfupload.js")%>"></script></p><p> <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/swf/fileprogress.js")%>"></script></p><p> <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/swf/filegroupprogress.js")%>"></script></p><p> <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/swf/handlers.js")%>"></script></p><p> <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery-1.4.1.min.js")%>"></script></p><p> <script type="text/javascript">
var swfu;</p><p> window.onload = function() {
var settings = {
post_params: {
"ASPSESSID": "<%=Session.SessionID %>"
},
file_post_name: "fileData",
// upload_url: '<%= ResolveUrl("~/upload/SaveUploadFile") %><%=paramUrl %>',
file_size_limit: "200 MB",
file_types: "*.doc;*.pdf;*.rar;",
file_types_description: "doc,pdf",
file_upload_limit: 200,
file_queue_limit: 0,
custom_settings: {</p><p> progressTarget: "divprogresscontainer",
progressGroupTarget: "divprogressGroup",</p><p> //progress object
container_css: "progressobj",
fname_css: "fle ftt",
state_div_css: "statebarSmallDiv",
state_bar_css: "statebar",
percent_css: "ftt",
href_delete_css: "ftt",</p><p> //sum object
/*
页面中不应出现以"cnt_"开头声明的元素
*/
s_cnt_progress: "cnt_progress",
s_cnt_span_text: "fle",
s_cnt_progress_statebar: "cnt_progress_statebar",
s_cnt_progress_percent: "cnt_progress_percent",
s_cnt_progress_uploaded: "cnt_progress_uploaded",
s_cnt_progress_size: "cnt_progress_size"
},
debug: false,</p><p> // Button settings
button_image_url: '<%= ResolveUrl("~/Content/images/XPButtonUploadText_61x22.png")%>',
button_width: "65",
button_height: "22",
button_placeholder_id: "spanButtonPlaceHolder",
button_text_left_padding: 12,
button_text_top_padding: 3,</p><p> // The event handler functions are defined in handlers.js
file_dialog_start_handler: fileDialogStart,
file_queued_handler: fileQueued,
file_queue_error_handler: fileQueueError,
upload_start_handler: uploadStart,
upload_progress_handler: uploadProgress,
upload_error_handler: uploadError,
upload_success_handler: uploadSuccess,
upload_complete_handler: uploadComplete,
file_dialog_complete_handler: fileDialogComplete,</p><p> flash_url: '<%= ResolveUrl("~/Content/swfupload.swf")%>',
flash9_url: '<%= ResolveUrl("~/Content/swfupload_FP9.swf")%>'// Relative to this file
};
swfu = new SWFUpload(settings);
};
</script></p><p> <script type="text/javascript"></p><p>
function startUpload() {
</p><p> var url = '<%= ResolveUrl("~/upload/SaveUploadFile") %>?<%=paramUrl %>';
if (document.getElementById("divZK") != null) {
url += "&nq=" + jQuery("#txt_Year").val() + jQuery("#txt_Q").val();
}
swfu.setUploadURL(url);
swfu.startUpload();</p><p> jQuery("#spanButtonPlaceHolder").attr("disable", 'true');
}</p><p> </script></p><p> </p><p></head>
<body>
<form id="frmMain" runat="server" enctype="multipart/form-data" enableviewstate="false">
<div style="height: 7px;">
</div>
<fieldset class="fieldset">
<legend>上传稿件</legend>
<p>
<label>
选择稿件:</label><input type="text" id="txtFileName" disabled="true" style="margin-top: -10px;
width: 240px;" />
<span id="spanButtonPlaceHolder"></span>
<br />
<span class="f_left">上传格式限DOC,PDF,方正排版文件,或上述文件格式的RAR压缩文件。(限制200M)</span>
</p>
<div id="divOp" runat="server" visible="false" style="display: none;">
<p>
<label>
篇名:</label></p>
<p>
<label>
作者:</label><input name="" type="text" id="txt_auth" style="width: 300px;" /><span>(多个作者用半角分号分隔)</span></p>
</div>
<input id="btupload" value="" class="btn4" type="button" onclick="startUpload();" />
</fieldset>
<input type="hidden" id="hf_handler" />
<input type="hidden" id="txt_name" />
</form>
</body>
</html></p>
你可以对Request.Files进行循环保存文件 Request.Files
进行循环保存文件。要么你在客户端设置一下只能同时上传一个文件 检查返回的报文 查看日志文件 好高深
页:
[1]