I am using SWFUpload for uploading files in my ASP.NET MVC3 Application. My implementation has two instances of SWFUpload in a single page. I am instantiating all the instances in a main page and have the controls in a partial page.
Main Page:
SWFUpload.onload = function () {
swfu1 = new SWFUpload({ /*settings*/ });
swfu2 = new SWFUpload({ /*settings*/ });
}
Partial view开发者_StackOverflow:
<input type="text" /><span id="spanButtonPlaceholder1"></span>
<input type="text" /><span id="spanButtonPlaceholder2"></span>
I am able to open the open file dialog box, but once I hit upload, I keep getting the following exception from swfupload.js:
Exception: TypeError Message: movieElement.CallFunction is not a function
How can I avoid getting this exception? Thanks!
1. When there is two swfupload accessing the javascript External Interface to javascript, only one instance of swfupload will be able to access the javascript External Interface. The other instance that do not have access to external interface will produce a javascript error.
There is a demo on Swfupload demo page
That php demo is working. Try to adapt the javascript and html into your MVC webpage. By the way, when there is two instances of flex/flash on the same page, one is your flex/flash app, another is your swfupload, both using external interface, you will also have the external interface problem.
If there are two flash instances on the same page, instead of using external interface, local connections between two flash instances is encouraged.
2. Some others have suggested to replace every instance of:
movieElement.CallFunction
into
this.movieElement.CallFunction
So that firebug does not stop on the error. I have tried this and it does not stop IE from complaining the same error.
3. If all else has failed, use two iframes for each uploader on the same page!
4. For your information: There is jQueryFileUpload.net available for you to use. Then, you can avoid this flash problem altogether.
精彩评论