<link href="/statics/js/swfupload/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/statics/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/statics/js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="/statics/js/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="/statics/js/swfupload/fileprogress.js"></script>
<script type="text/javascript" src="/statics/js/swfupload/filegroupprogress.js"></script>
<script type="text/javascript" src="/statics/js/swfupload/handlers.js">
<script type="text/javascript">
var swfu;
window.onload = function () {
var settings = {
flash_url: "statics/js/swfupload/swfupload.swf",
upload_url: "upload.ashx",
file_size_limit: "2 MB",
file_types: "*.*",
file_types_description: "All Files",
file_upload_limit: 50,
file_queue_limit: 0,
autoremove: true, //是否自动移除完成上传的记录
custom_settings: {
progressTarget: "divprogresscontainer",
progressGroupTarget: "divprogressGroup",
container_css: "progressobj",
icoNormal_css: "IcoNormal",
icoWaiting_css: "IcoWaiting",
icoUpload_css: "IcoUpload",
fname_css: "fle ftt", state_div_css: "statebarSmallDiv",
vstate_bar_css: "statebar",
percent_css: "ftt",
href_delete_css: "ftt",
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,
button_image_url: "/statics/js/swfupload/images/swfBnt_select.png",
button_width: "75",
button_height: "28",
button_placeholder_id: "spanButtonPlaceHolder",
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
};
swfu = new SWFUpload(settings);
};
</script>
<div id="scDiv" runat="server">
<table cellpadding="5">
<tr>
<td style="padding:5px;"><span id="spanButtonPlaceHolder"></span></td>
<td style="padding:5px;"><span class="btn_upload" onclick='swfu.startUpload()'><img src="/statics/js/swfupload/images/swfBnt_upload.png" /></span></td>
<td style="padding:5px;"><div id="nameTip" class="onShow">最多上传<font color="red"> <asp:Literal ID="Literal2" runat="server"></asp:Literal></font> 个附件,单文件最大
<font color="red"><asp:Literal ID="Literal3" runat="server"></asp:Literal></font></div></td>
</tr>
<tr>
<td colspan="3" style="padding:5px;">支持 <asp:Literal ID="Literal4" runat="server"></asp:Literal>格式。</td>
</tr>
<tr>
<td colspan="2">备注:<asp:TextBox ID="TextBox1" Width="65" runat="server"></asp:TextBox></td>
<td>类别:<asp:DropDownList ID="DropDownList1" Width="80" runat="server"></asp:DropDownList></td>
</tr>
<tr>
<td>
<asp:DropDownList ID="DropDownList2" runat="server"></asp:DropDownList></td>
</tr>
</table>
<div class="uploadbox">
<span class="uploadbox_t">列表</span>
<div id="divprogresscontainer"></div>
<div id="divprogressGroup"></div>
<div id="piclist">
<ul>
</ul>
</div>
</div>
<br /><br />
<input type="hidden" name="tb_imgurls" id="tb_imgurls" value=""/><br />
<input type="hidden" name="piclists" id="piclists" value=""/>
<div style="margin-left:300px;clear:both;">
<table>
<tr>
<td><div class="submit"><input type="button" value="确定" onclick="confirmupload()"/></div></td>
<td><div class="submit"><input type="button" value="取消" onclick="parent.TB_remove();" /></div> </td>
</tr>
</table>
</div>
</div>
最后的的效果是这样的:
根据 button_image_url: "/statics/js/swfupload/images/swfBnt_select.png",
button_width: "75",
button_height: "28",
button_placeholder_id: "spanButtonPlaceHolder",应该会有一个按钮出现在开始上传的左侧的,为什么没有?
求各位大哥帮忙看看。小弟可以微信给你发红包表示感谢
7 个解决方案
#1
很急,小弟在线等
#2
#3
就没有哪位大哥帮帮我吗?急白了头。。。
#4
做个参考吧
<!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 id="Head1"><title>
无标题页
</title><link href="css/select_box.css" rel="stylesheet" type="text/css" /><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/swfupload.queue.js"></script>
<script type="text/javascript" src="js/fileprogress.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<script type="text/javascript">
var swfu;
window.onload = function() {
var settings = {
flash_url : "swfupload/swfupload.swf",
upload_url: "swfupload.aspx",
post_params: {
"ASPSESSID" : "wvjfun553gcvon3r3l0dzgf3",
"UploadType" : "image"
},
file_size_limit : "600",
file_types : "*.jpg;*.jpeg;*.gif;*.png",
file_types_description : "图像上传",
file_upload_limit :10,
file_queue_limit : 0,
custom_settings : {
progressTarget : "fsUploadProgress",
cancelButtonId : "btnCancel"
},
debug: false,
// Button settings
button_image_url: "images/XPButtonNoText_75x28.jpg",
button_width: "85",
button_height: "28",
button_placeholder_id: "spanButtonPlaceHolder",
button_text: '',
button_text_style: "cursor:hand;",
button_text_left_padding: 0,
button_text_top_padding: 0,
button_cursor: SWFUpload.CURSOR.HAND,
// The event handler functions are defined in handlers.js
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogCompleteCheck,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
queue_complete_handler : queueComplete // Queue plugin event
};
swfu = new SWFUpload(settings);
};
function fileDialogCompleteCheck(numFilesSelected, numFilesQueued) {
try {
if (numFilesQueued <= 0) {
alert("请选择上传文件");
}
} catch (ex) {
this.debug(ex);
}
}
</script>
</head>
<body>
<form name="form1" method="post" action="UploadFile.aspx?UploadType=image&___t0.11534798494540155" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE4MjU3NDQ4NzVkZP8mbOylOqBLpUka+2QwKILFfqwL" />
</div>
<div>
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="C375968E" />
</div>
<div id="select_box">
<div class="tagMenu">
<ul class="menu">
<li class="current"><a href="#">上传图像</a></li>
<li><a href="selectfile.aspx?showtype=image&uploadtype=image&textboxid=">图库</a></li>
<li><a href="selectfile.aspx?showtype=video&uploadtype=image&textboxid=">视频</a></li>
<li><a href="selectfile.aspx?showtype=download&uploadtype=image&textboxid=">附件</a></li>
<li><a href="selectfiledir.aspx?uploadtype=image&textboxid=">目录浏览</a></li>
</ul>
</div>
<div class="content">
<div class="layout" style="padding:10px;">
<p style="padding-left:10px; line-height:30px;">注:上传文件完成后请到当天目录下查找文件</p>
<div style="padding-left:5px;">
<table width="60%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" align="center"><span id="spanButtonPlaceHolder"></span></td>
<td width="33%" align="center"><input type="button" onclick="swfu.startUpload();" onmouseover="this.style.cursor='pointer';" style="background:url(Images/start.jpg) no-repeat ;border:0px; width:75px; height:28px; float:left;" /></td>
<td width="33%" align="center"><input id="btnCancel" type="button" onclick="swfu.cancelQueue();" onmouseover="this.style.cursor='pointer';"
style="background:url(Images/cancel.jpg) no-repeat; border:0px; width:75px; height:28px; line-height:28px;" /></td>
</tr>
</table>
</div>
<div class="fieldset flash" id="fsUploadProgress">
<span class="legend" style="font-size:12px;">列表</span>
</div>
<div id="divStatus" style="height:30px; line-height:30px; padding-left:3px;">0 文件已上传</div>
</div>
</div>
</div>
</form>
</body>
</html>
<!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 id="Head1"><title>
无标题页
</title><link href="css/select_box.css" rel="stylesheet" type="text/css" /><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/swfupload.queue.js"></script>
<script type="text/javascript" src="js/fileprogress.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<script type="text/javascript">
var swfu;
window.onload = function() {
var settings = {
flash_url : "swfupload/swfupload.swf",
upload_url: "swfupload.aspx",
post_params: {
"ASPSESSID" : "wvjfun553gcvon3r3l0dzgf3",
"UploadType" : "image"
},
file_size_limit : "600",
file_types : "*.jpg;*.jpeg;*.gif;*.png",
file_types_description : "图像上传",
file_upload_limit :10,
file_queue_limit : 0,
custom_settings : {
progressTarget : "fsUploadProgress",
cancelButtonId : "btnCancel"
},
debug: false,
// Button settings
button_image_url: "images/XPButtonNoText_75x28.jpg",
button_width: "85",
button_height: "28",
button_placeholder_id: "spanButtonPlaceHolder",
button_text: '',
button_text_style: "cursor:hand;",
button_text_left_padding: 0,
button_text_top_padding: 0,
button_cursor: SWFUpload.CURSOR.HAND,
// The event handler functions are defined in handlers.js
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogCompleteCheck,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
queue_complete_handler : queueComplete // Queue plugin event
};
swfu = new SWFUpload(settings);
};
function fileDialogCompleteCheck(numFilesSelected, numFilesQueued) {
try {
if (numFilesQueued <= 0) {
alert("请选择上传文件");
}
} catch (ex) {
this.debug(ex);
}
}
</script>
</head>
<body>
<form name="form1" method="post" action="UploadFile.aspx?UploadType=image&___t0.11534798494540155" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE4MjU3NDQ4NzVkZP8mbOylOqBLpUka+2QwKILFfqwL" />
</div>
<div>
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="C375968E" />
</div>
<div id="select_box">
<div class="tagMenu">
<ul class="menu">
<li class="current"><a href="#">上传图像</a></li>
<li><a href="selectfile.aspx?showtype=image&uploadtype=image&textboxid=">图库</a></li>
<li><a href="selectfile.aspx?showtype=video&uploadtype=image&textboxid=">视频</a></li>
<li><a href="selectfile.aspx?showtype=download&uploadtype=image&textboxid=">附件</a></li>
<li><a href="selectfiledir.aspx?uploadtype=image&textboxid=">目录浏览</a></li>
</ul>
</div>
<div class="content">
<div class="layout" style="padding:10px;">
<p style="padding-left:10px; line-height:30px;">注:上传文件完成后请到当天目录下查找文件</p>
<div style="padding-left:5px;">
<table width="60%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" align="center"><span id="spanButtonPlaceHolder"></span></td>
<td width="33%" align="center"><input type="button" onclick="swfu.startUpload();" onmouseover="this.style.cursor='pointer';" style="background:url(Images/start.jpg) no-repeat ;border:0px; width:75px; height:28px; float:left;" /></td>
<td width="33%" align="center"><input id="btnCancel" type="button" onclick="swfu.cancelQueue();" onmouseover="this.style.cursor='pointer';"
style="background:url(Images/cancel.jpg) no-repeat; border:0px; width:75px; height:28px; line-height:28px;" /></td>
</tr>
</table>
</div>
<div class="fieldset flash" id="fsUploadProgress">
<span class="legend" style="font-size:12px;">列表</span>
</div>
<div id="divStatus" style="height:30px; line-height:30px; padding-left:3px;">0 文件已上传</div>
</div>
</div>
</div>
</form>
</body>
</html>
#5
@lovebaby 可以加QQ帮我看下吗?
#6
#7
@lovebaby ,谢谢你,分给你了,原来不是代码的问题,原因是:要使用swfupload必须要在一个单独的页面才能完成。希望大家别跟我一样。
#1
很急,小弟在线等
#2
#3
就没有哪位大哥帮帮我吗?急白了头。。。
#4
做个参考吧
<!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 id="Head1"><title>
无标题页
</title><link href="css/select_box.css" rel="stylesheet" type="text/css" /><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/swfupload.queue.js"></script>
<script type="text/javascript" src="js/fileprogress.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<script type="text/javascript">
var swfu;
window.onload = function() {
var settings = {
flash_url : "swfupload/swfupload.swf",
upload_url: "swfupload.aspx",
post_params: {
"ASPSESSID" : "wvjfun553gcvon3r3l0dzgf3",
"UploadType" : "image"
},
file_size_limit : "600",
file_types : "*.jpg;*.jpeg;*.gif;*.png",
file_types_description : "图像上传",
file_upload_limit :10,
file_queue_limit : 0,
custom_settings : {
progressTarget : "fsUploadProgress",
cancelButtonId : "btnCancel"
},
debug: false,
// Button settings
button_image_url: "images/XPButtonNoText_75x28.jpg",
button_width: "85",
button_height: "28",
button_placeholder_id: "spanButtonPlaceHolder",
button_text: '',
button_text_style: "cursor:hand;",
button_text_left_padding: 0,
button_text_top_padding: 0,
button_cursor: SWFUpload.CURSOR.HAND,
// The event handler functions are defined in handlers.js
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogCompleteCheck,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
queue_complete_handler : queueComplete // Queue plugin event
};
swfu = new SWFUpload(settings);
};
function fileDialogCompleteCheck(numFilesSelected, numFilesQueued) {
try {
if (numFilesQueued <= 0) {
alert("请选择上传文件");
}
} catch (ex) {
this.debug(ex);
}
}
</script>
</head>
<body>
<form name="form1" method="post" action="UploadFile.aspx?UploadType=image&___t0.11534798494540155" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE4MjU3NDQ4NzVkZP8mbOylOqBLpUka+2QwKILFfqwL" />
</div>
<div>
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="C375968E" />
</div>
<div id="select_box">
<div class="tagMenu">
<ul class="menu">
<li class="current"><a href="#">上传图像</a></li>
<li><a href="selectfile.aspx?showtype=image&uploadtype=image&textboxid=">图库</a></li>
<li><a href="selectfile.aspx?showtype=video&uploadtype=image&textboxid=">视频</a></li>
<li><a href="selectfile.aspx?showtype=download&uploadtype=image&textboxid=">附件</a></li>
<li><a href="selectfiledir.aspx?uploadtype=image&textboxid=">目录浏览</a></li>
</ul>
</div>
<div class="content">
<div class="layout" style="padding:10px;">
<p style="padding-left:10px; line-height:30px;">注:上传文件完成后请到当天目录下查找文件</p>
<div style="padding-left:5px;">
<table width="60%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" align="center"><span id="spanButtonPlaceHolder"></span></td>
<td width="33%" align="center"><input type="button" onclick="swfu.startUpload();" onmouseover="this.style.cursor='pointer';" style="background:url(Images/start.jpg) no-repeat ;border:0px; width:75px; height:28px; float:left;" /></td>
<td width="33%" align="center"><input id="btnCancel" type="button" onclick="swfu.cancelQueue();" onmouseover="this.style.cursor='pointer';"
style="background:url(Images/cancel.jpg) no-repeat; border:0px; width:75px; height:28px; line-height:28px;" /></td>
</tr>
</table>
</div>
<div class="fieldset flash" id="fsUploadProgress">
<span class="legend" style="font-size:12px;">列表</span>
</div>
<div id="divStatus" style="height:30px; line-height:30px; padding-left:3px;">0 文件已上传</div>
</div>
</div>
</div>
</form>
</body>
</html>
<!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 id="Head1"><title>
无标题页
</title><link href="css/select_box.css" rel="stylesheet" type="text/css" /><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/swfupload.queue.js"></script>
<script type="text/javascript" src="js/fileprogress.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<script type="text/javascript">
var swfu;
window.onload = function() {
var settings = {
flash_url : "swfupload/swfupload.swf",
upload_url: "swfupload.aspx",
post_params: {
"ASPSESSID" : "wvjfun553gcvon3r3l0dzgf3",
"UploadType" : "image"
},
file_size_limit : "600",
file_types : "*.jpg;*.jpeg;*.gif;*.png",
file_types_description : "图像上传",
file_upload_limit :10,
file_queue_limit : 0,
custom_settings : {
progressTarget : "fsUploadProgress",
cancelButtonId : "btnCancel"
},
debug: false,
// Button settings
button_image_url: "images/XPButtonNoText_75x28.jpg",
button_width: "85",
button_height: "28",
button_placeholder_id: "spanButtonPlaceHolder",
button_text: '',
button_text_style: "cursor:hand;",
button_text_left_padding: 0,
button_text_top_padding: 0,
button_cursor: SWFUpload.CURSOR.HAND,
// The event handler functions are defined in handlers.js
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogCompleteCheck,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
queue_complete_handler : queueComplete // Queue plugin event
};
swfu = new SWFUpload(settings);
};
function fileDialogCompleteCheck(numFilesSelected, numFilesQueued) {
try {
if (numFilesQueued <= 0) {
alert("请选择上传文件");
}
} catch (ex) {
this.debug(ex);
}
}
</script>
</head>
<body>
<form name="form1" method="post" action="UploadFile.aspx?UploadType=image&___t0.11534798494540155" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE4MjU3NDQ4NzVkZP8mbOylOqBLpUka+2QwKILFfqwL" />
</div>
<div>
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="C375968E" />
</div>
<div id="select_box">
<div class="tagMenu">
<ul class="menu">
<li class="current"><a href="#">上传图像</a></li>
<li><a href="selectfile.aspx?showtype=image&uploadtype=image&textboxid=">图库</a></li>
<li><a href="selectfile.aspx?showtype=video&uploadtype=image&textboxid=">视频</a></li>
<li><a href="selectfile.aspx?showtype=download&uploadtype=image&textboxid=">附件</a></li>
<li><a href="selectfiledir.aspx?uploadtype=image&textboxid=">目录浏览</a></li>
</ul>
</div>
<div class="content">
<div class="layout" style="padding:10px;">
<p style="padding-left:10px; line-height:30px;">注:上传文件完成后请到当天目录下查找文件</p>
<div style="padding-left:5px;">
<table width="60%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" align="center"><span id="spanButtonPlaceHolder"></span></td>
<td width="33%" align="center"><input type="button" onclick="swfu.startUpload();" onmouseover="this.style.cursor='pointer';" style="background:url(Images/start.jpg) no-repeat ;border:0px; width:75px; height:28px; float:left;" /></td>
<td width="33%" align="center"><input id="btnCancel" type="button" onclick="swfu.cancelQueue();" onmouseover="this.style.cursor='pointer';"
style="background:url(Images/cancel.jpg) no-repeat; border:0px; width:75px; height:28px; line-height:28px;" /></td>
</tr>
</table>
</div>
<div class="fieldset flash" id="fsUploadProgress">
<span class="legend" style="font-size:12px;">列表</span>
</div>
<div id="divStatus" style="height:30px; line-height:30px; padding-left:3px;">0 文件已上传</div>
</div>
</div>
</div>
</form>
</body>
</html>
#5
@lovebaby 可以加QQ帮我看下吗?
#6
#7
@lovebaby ,谢谢你,分给你了,原来不是代码的问题,原因是:要使用swfupload必须要在一个单独的页面才能完成。希望大家别跟我一样。