<!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 >
<title>上传产品图片</title>
<script src="/WebLib/Common/jquery-1.8.0-vsdoc.js" type="text/javascript"></script>
<link href="Css/Tabstyle.css" rel="stylesheet" type="text/css" />
<!--扩展上传脚本组件 Start-->
<script src="/WebLib/Common/Component/Uploadify/jquery.uploadify.js" type="text/javascript"></script>
<link href="/WebLib/Common/Component/Uploadify/uploadify.css" rel="stylesheet" type="text/css" />
<!--扩展上传脚本组件 End-->
<script language="javascript" type="text/javascript">
$(function () {
if ($("#transTab h2 a").length > 1) {
$("#transTab h2 a").click(this, function () {
$("#transTab h2 a").removeClass("current");
$(this).addClass("current");
$(".transSub").hide();
var index = $("#transTab h2 a").index(this);
$(".transSub").eq(index).show(); });
} $('#file_upload').uploadify({
'formData': {
'ID': '7'
},
'swf': '/WebLib/Common/Component/Uploadify/uploadify.swf',
'uploader': '/Handler/UploadifyHandler.ashx?action=uploadfyproductimg&imgtype=1',
'multi': false,
'debug':true,
'queueID': 'queue',
'buttonText': '选择产品默认图片',
'onUploadSuccess': function (file, data, response) {//上传完成时触发(每个文件触发一次)
alert(2);
$("#imglist").append("<li>" + file.name + "[" + (file.size / 1024).toFixed(2) + "K]<img src='" + data + "'/></li>");
}
}); $('#file_upload2').uploadify({
'formData': {
'ID': '7'
},
'swf': '/WebLib/Common/Component/Uploadify/uploadify.swf',
'uploader': '/Handler/UploadifyHandler.ashx?action=uploadfyproductimg&imgtype=2',
'multi': true,
'debug': true,
'queueID': 'queue2',
'buttonText': '选择产品展示图片',
'onUploadSuccess': function (file, data, response) {//上传完成时触发(每个文件触发一次)
alert(3);
$("#imglist").append("<li>" + file.name + "[" + (file.size / 1024).toFixed(2) + "K]<img src='" + data + "'/></li>");
}
});
});
</script>
</head>
<body> <div id="queue"></div>
<input id="file_upload" name="file_upload" type="file" /> <!-- 经典代码专区 Start-->
<div class="detail2_title trans_title" id="transTab" style="margin-top: 20px; margin-left: auto;
margin-right: auto;">
<h2>
<a href="javascript:void(0);" class="current"><b></b>首页图片</a></h2>
<h2>
<a href="javascript:void(0);" class=""><b></b>明细图片</a></h2>
</div>
<div class="transSub" style="display: block;">
<div class="htl_info_table">
</div>
</div>
<div style="display: none;" class="transSub">
<div class="htl_info_table">
<div id="queue2"></div>
<input id="file_upload2" name="file_upload2" type="file" />
<table width="100%" border="1" cellspacing="0" cellpadding="4" style="border-collapse: collapse" style=" text-align:center;">
</table>
</div>
</div>
<!-- 经典代码专区 End-->
</body>
</html>
当我点击那个浏览文件按钮的时候,文件出现在列表框,然后显示文件名-文件大小,Failed
附带调试信息如下,谁能帮我看看这个到底是啥错【SecurityError #2156】,我拷贝这个html到另外测试项目都很正常,郁闷
了耗了2个小时多。还是没头目。弄到测试项目,
'uploader': '/Handler/UploadifyHandler.ashx?action=uploadfyproductimg&imgtype=2',
同样这个文件代码,测试这个服务器端处理没错。===============================================================
---SWFUpload Instance Info---
Version: 2.2.0 2009-03-25
Movie Name: SWFUpload_0
Settings:
upload_url: /Handler/UploadifyHandler.ashx?action=uploadfyproductimg&imgtype=1
flash_url: /WebLib/Common/Component/Uploadify/uploadify.swf?preventswfcaching=1364518697718
use_query_string: false
requeue_on_error: false
http_success:
assume_success_timeout: 30
file_post_name: Filedata
post_params: [object Object]
file_types: *.*
file_types_description: All Files
file_size_limit: 0
file_upload_limit: 0
file_queue_limit: 999
debug: true
prevent_swf_caching: true
button_placeholder_id: file_upload
button_placeholder: Not Set
button_image_url: /Manage/
button_width: 120
button_height: 30
button_text:
button_text_style: color: #000000; font-size: 16pt;
button_text_top_padding: 0
button_text_left_padding: 0
button_action: -100
button_disabled: false
custom_settings: [object Object]
Event Handlers:
swfupload_loaded_handler assigned: false
file_dialog_start_handler assigned: true
file_queued_handler assigned: true
file_queue_error_handler assigned: true
upload_start_handler assigned: true
upload_progress_handler assigned: true
upload_error_handler assigned: true
upload_success_handler assigned: true
upload_complete_handler assigned: true
debug_handler assigned: true---SWFUpload Instance Info---
Version: 2.2.0 2009-03-25
Movie Name: SWFUpload_1
Settings:
upload_url: /Handler/UploadifyHandler.ashx?action=uploadfyproductimg&imgtype=2
flash_url: /WebLib/Common/Component/Uploadify/uploadify.swf?preventswfcaching=1364518697721
use_query_string: false
requeue_on_error: false
http_success:
assume_success_timeout: 30
file_post_name: Filedata
post_params: [object Object]
file_types: *.*
file_types_description: All Files
file_size_limit: 0
file_upload_limit: 0
file_queue_limit: 999
debug: true
prevent_swf_caching: true
button_placeholder_id: file_upload2
button_placeholder: Not Set
button_image_url: /Manage/
button_width: 120
button_height: 30
button_text:
button_text_style: color: #000000; font-size: 16pt;
button_text_top_padding: 0
button_text_left_padding: 0
button_action: -110
button_disabled: false
custom_settings: [object Object]
Event Handlers:
swfupload_loaded_handler assigned: false
file_dialog_start_handler assigned: true
file_queued_handler assigned: true
file_queue_error_handler assigned: true
upload_start_handler assigned: true
upload_progress_handler assigned: true
upload_error_handler assigned: true
upload_success_handler assigned: true
upload_complete_handler assigned: true
debug_handler assigned: trueSWF DEBUG: SWFUpload Init Complete
SWF DEBUG:
SWF DEBUG: ----- SWF DEBUG OUTPUT ----
SWF DEBUG: Build Number: SWFUPLOAD 2.2.0
SWF DEBUG: movieName: SWFUpload_0
SWF DEBUG: Upload URL: /Handler/UploadifyHandler.ashx?action=uploadfyproductimg&imgtype=1
SWF DEBUG: File Types String: *.*
SWF DEBUG: Parsed File Types:
SWF DEBUG: HTTP Success: 0
SWF DEBUG: File Types Description: All Files (*.*)
SWF DEBUG: File Size Limit: 0 bytes
SWF DEBUG: File Upload Limit: 0
SWF DEBUG: File Queue Limit: 999
SWF DEBUG: Post Params:
SWF DEBUG: ID=7
SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
SWF DEBUG:
Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)
SWF DEBUG: Event: fileDialogStart : Browsing files. Single Select. Allowed file types: *.*
SWF DEBUG: Event: fileDialogComplete: File Dialog window cancelled.
SWF DEBUG: StartUpload: First file in queue
SWF DEBUG: StartUpload(): No files found in the queue.
SWF DEBUG: Event: fileDialogStart : Browsing files. Single Select. Allowed file types: *.*
SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list...
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1
SWF DEBUG: StartUpload: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
SWF DEBUG: Global Post Item: ID=7
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to /Handler/UploadifyHandler.ashx?action=uploadfyproductimg&imgtype=1 for File ID: SWFUpload_0_0
SWF DEBUG: ReturnUploadStart: Exception occurred: null
SWF DEBUG: Event: uploadError(): Upload Failed. Exception occurred: 2156
SWF DEBUG: SecurityError
SWF DEBUG: Error #2156
SWF DEBUG: null
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货