最近项目中需要使用多文件上传,并将文件信息写入到数据库,将SWFUpload控件的Default.aspx文件修改如下:
----------------------------<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>MultiUpload(ASP.Net 2.0)</title>
<link href="css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="swfupload/swfupload.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<script type="text/javascript">
var swfu;
window.onload = function () {
swfu = new SWFUpload({
// Backend Settings
upload_url: "upload.aspx",
post_params : { //key-values will sand to server when file send to server; user can set it
"ASPSESSID" : "<%=Session.SessionID %>"
//"PRODUCTTYPE": "NO DATA"
}, // File Upload Settings
file_size_limit : "10 MB",
file_types : "*.zip; *.pdf; *.txt",
file_types_description : "Source File",
file_upload_limit : "0", // Zero means unlimited // Event Handler Settings - these functions as defined in Handlers.js
// The handlers are not part of SWFUpload but are part of my website and control how
// my website reacts to the SWFUpload events.
file_queued_handler: fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler: uploadComplete, // Button settings
// button_image_url : "images/XPButtonNoText_160x22.png",
// button_placeholder_id : "spanButtonPlaceholder",
// button_width: 160,
// button_height: 22,
// button_text : '<span class="button">Select Files <span class="buttonSmall">(10 MB Max)</span></span>',
// button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }',
// button_text_top_padding: 1,
// button_text_left_padding: 5, // Flash Settings
flash_url : "swfupload/swfupload.swf", // Relative to this file custom_settings : {
upload_target : "divFileProgressContainer"
}, // Debug Settings
debug: false
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="header">
<h1 id="logo"></h1>
<div id="version">v2.2.0</div>
</div> <div id="content">
<h2>MultiUpload(ASP.Net 2.0)</h2>
<div id="swfu_container" style="margin: 0px 10px;">
<div>
<button id="btnBrowse" type="button" style="padding: 5px;" onclick="swfu.selectFiles(); this.blur();"><img src="images/page_white_add.png" style="padding-right: 3px; vertical-align: bottom;" alt="Add Icon"/>Select Files <span style="font-size: 7pt;">(10 MB Max)</span></button>
<asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="Save Select Files" Width="150px"/>
<asp:Button ID="btnClear" runat="server" OnClick="btnClear_Click" Text="Clear Select Files" Width="150px"/>
</div>
<div id="divFileProgressContainer" style="height: 75px;"></div>
<div id="thumbnails"></div>
</div>
</div>
</form>
</body>
</html>结果一直报一个错误:
“Microsoft JScript runtime error: Exception thrown and not caught”麻烦大神帮忙看看什么地方出了问题,怎么调试?工程文件怎么才能打包放上来?SWFUpload控件上传
----------------------------<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>MultiUpload(ASP.Net 2.0)</title>
<link href="css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="swfupload/swfupload.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<script type="text/javascript">
var swfu;
window.onload = function () {
swfu = new SWFUpload({
// Backend Settings
upload_url: "upload.aspx",
post_params : { //key-values will sand to server when file send to server; user can set it
"ASPSESSID" : "<%=Session.SessionID %>"
//"PRODUCTTYPE": "NO DATA"
}, // File Upload Settings
file_size_limit : "10 MB",
file_types : "*.zip; *.pdf; *.txt",
file_types_description : "Source File",
file_upload_limit : "0", // Zero means unlimited // Event Handler Settings - these functions as defined in Handlers.js
// The handlers are not part of SWFUpload but are part of my website and control how
// my website reacts to the SWFUpload events.
file_queued_handler: fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler: uploadComplete, // Button settings
// button_image_url : "images/XPButtonNoText_160x22.png",
// button_placeholder_id : "spanButtonPlaceholder",
// button_width: 160,
// button_height: 22,
// button_text : '<span class="button">Select Files <span class="buttonSmall">(10 MB Max)</span></span>',
// button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }',
// button_text_top_padding: 1,
// button_text_left_padding: 5, // Flash Settings
flash_url : "swfupload/swfupload.swf", // Relative to this file custom_settings : {
upload_target : "divFileProgressContainer"
}, // Debug Settings
debug: false
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="header">
<h1 id="logo"></h1>
<div id="version">v2.2.0</div>
</div> <div id="content">
<h2>MultiUpload(ASP.Net 2.0)</h2>
<div id="swfu_container" style="margin: 0px 10px;">
<div>
<button id="btnBrowse" type="button" style="padding: 5px;" onclick="swfu.selectFiles(); this.blur();"><img src="images/page_white_add.png" style="padding-right: 3px; vertical-align: bottom;" alt="Add Icon"/>Select Files <span style="font-size: 7pt;">(10 MB Max)</span></button>
<asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="Save Select Files" Width="150px"/>
<asp:Button ID="btnClear" runat="server" OnClick="btnClear_Click" Text="Clear Select Files" Width="150px"/>
</div>
<div id="divFileProgressContainer" style="height: 75px;"></div>
<div id="thumbnails"></div>
</div>
</div>
</form>
</body>
</html>结果一直报一个错误:
“Microsoft JScript runtime error: Exception thrown and not caught”麻烦大神帮忙看看什么地方出了问题,怎么调试?工程文件怎么才能打包放上来?SWFUpload控件上传
解决方案 »
- http://www.3dliuliu.com/ 这个网站右边的浮动条是怎么做的?
- web.config里的元素属性问题
- 熟悉表结构的来,共同研究一下解决方案.
- 菜鸟刚学asp.net,我想打开一个不带菜单和工具条的网页,我设置了他的高度,结果高度最小也就300左右,设到再小也没用了,怎么回事呢?
- 怎么样在一个已经有的图片上绘图。
- 关于在asp.net(c#)中调用有关操作数据库的dll文件的不解之处,50分求解。
- 图片存入数据库而不使用存储过程,请高手帮忙看看
- 求freetextbox的汉化版本最好是1.6.3谢谢各位^_^
- quickstart 数据库连接问题
- 一个关于UPDATE的SQL语句
- .net查询数据库多个值赋给多个变量
- 升级到 64位系统 外部 js css 都引用不到
这类错误最头疼了,笨方法是加alert缩小错误范围,就是在代码处逐步加alert,看哪个alert没弹出来,就知道大概错误的行了
错误原因是我把Line 40左右的Button setting删掉了,换成了Line 73的三个Button,结果出现了异常,有没有方法调试JavaScript代码?