<script type="text/javascript">
var swfu;
window.onload = function () {
swfu = new SWFUpload({
// Backend Settings
upload_url: "Upload.ashx",
post_params: {
"name": "<%=this.txtName.Text %>",
"type": "<%=this.txtType.Text %>",
"image": "<%=this.txtFile.Text %>"
},
use_query_string: true,
// File Upload Settings
// File Upload Settings
file_size_limit: "4 MB",
file_types: "*.*",
file_types_description: " ",
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.
swfupload_preload_handler: preLoad,
swfupload_load_failed_handler: loadFailed,
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:
"/js/swfupload/images/XPButtonNoText_160x22.png",
button_placeholder_id: "spanButtonPlaceholder",
button_width: 90,
button_height: 22,
button_text: '选择上传文件',
button_text_style: '.button { background-color :#DAE8F0 } ',
button_text_top_padding: 1,
button_text_left_padding: 5,
// Flash Settings
flash_url: "/js/swfupload/swfupload.swf", // Relative to this
file
flash9_url: "/js/swfupload/swfupload_FP9.swf", // Relative to
this file
custom_settings: {
upload_target: "divFileProgressContainer",
cancelButtonId: "btnCancel1"
},
// Debug Settings
debug: false
});
$("#btnUpload1").click(function () {
if (document.getElementById("ddlType").value == "请首先选择上传
附件类型") {
alert("请首先选择上传附件类型");
return;
};
//swfu.addPostParam("typef", "<%=this.ddlType.SelectedValue %
>");
// this.setPostParam("typef", "<%=this.ddlType.SelectedValue %
>");
this.setPostParams({ "name": "<%=this.txtName.Text %>",
"type": "<%=this.txtType.Text %>",
"image": "<%=this.txtFile.Text %>", "typef": "<%
=this.ddlType.SelectedValue %>" });
swfu.startUpload();
});
}
</script>
如何在页面加载完之后 再次修改PostParams 取得this.ddlType.SelectedValue 这个值然后
传给请求的页面Upload.ashx
帮顶!!!!
var swfu;
if (swfu) {swfu.destroy(); }
swfu = new SWFUpload(getSettings);
getSettings就是你上面的配置 重新初始化一次
谢谢 ,已经能修改了 通过 swfu.setPostParams({
"name": $('txtName').val(),
"type": $('txtType').val(),
"typef": $('#ddlType').val(),
"image": $('txtFile').val()
});
swfu.startUpload();
swfu.uploadStart(swfu.initSettings);
@蜜乐佛: swfu.setPostParams({
"name": $('txtName').val(),
"type": $('txtType').val(),
"typef": $('#ddlType').val(),
"image": $('txtFile').val()
});
swfu.startUpload();
swfu.uploadStart(swfu.initSettings);
你这些代码是写在哪里的啊
swfu.uploadStart(swfu.initSettings);