0

I am using ElementIT's MultiPowUpload v3.3 and I have the standalone, Flash portion working. My problem is when I make the upload button invisible and need to trigger the upload via a standard form element button.

<form id="myform" name="myform" action="" method="post">
<select name="menu" MULTIPLE size="2">
<option value="1">some menu item 1</option>
<option value="2">some menu item 2</option>
</select>
<input name="text" type="text" value="some text">
<input type="hidden" name="hdn_frm_submit" id="hdn_frm_submit" value="Upload Files" />
<input type="submit" name="btn_sub" value="Submit Form">

<div id="MultiPowUpload_holder"></div>

<script type="text/javascript" src="Extra/swfobject.js"></script>
<script type="text/javascript">
var params = {  
    BGColor: "#FFFFFF"
};

var attributes = {  
    id: "MultiPowUpload",  
    name: "MultiPowUpload"
};

//MultiPowUpload partameters goes here
var flashvars = {       
  "serialNumber": "MY_SERIAL_NUMBER_INSERTED_HERE",
  "uploadUrl": "insert_the_processing_page_here",
  "formName": "myform",
      "uploadButton.visible": "false",
  "uploadButton.action": "2",
  "useExternalInterface": "true"
};
//Default MultiPowUpload should have minimum width=400 and minimum height=180
swfobject.embedSWF("ElementITMultiPowUpload.swf", "MultiPowUpload_holder", "400", "250", "10.0.0", "Extra/expressInstall.swf", flashvars, params, attributes);
</script>
</form>

I have jQuery available on the page so I will place the Submit button click handler in the doc.ready section. How do I address the Flash uploader's Upload button with jQuery? Any feedback will be greatly appreciated.

4

1 回答 1

1

您可以使用ExternalInterface
http://www.element-it.com/OnlineHelpMulti/MultiPowUpload_Manual_HTML/tutorial.html#javaScript

可能您正在寻找uploadAll方法
http://www.element-it.com/OnlineHelpMulti/Methods.html#uploadAll

您需要添加到示例中的代码将是:

<script>
   $(document).ready(function () {
     $("#btn_sub").click(function() {
       $("#MultiPowUpload").uploadAll("uploadfiles.aspx");
     });
   });
</script>

但您还需要将按钮类型从更改submitbutton以防止从 html 提交表单。

<input type="button" name="btn_sub" value="Upload Files">

我使用了这个文档:
http://api.jquery.com/ready/
http://api.jquery.com/click/
http://api.jquery.com/id-selector/

于 2013-04-03T02:10:54.810 回答