Uploadify上传报错uncaught exception: ID SWFUpload_0 is already in use.

版本:Uploadify v3.2

uncaught exception: ID SWFUpload_0 is already in use. The Flash Object could not be added

Uploadify上传报错SWFUpload_0已存在

一般是由于引用了两遍jquery.uploadify.js造成的,

 

问题分析

用eclipse把jquery.uploadify.js 72行格式化,选中72行,Ctrl+Shit+F

 

var SWFUpload;
if (SWFUpload == undefined) {
	SWFUpload = function(a) {
		this.initSWFUpload(a)
	}
}
SWFUpload.prototype.initSWFUpload = function(b) {
	try {
		this.customSettings = {};
		this.settings = b;
		this.eventQueue = [];
		this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
		this.movieElement = null;
		SWFUpload.instances[this.movieName] = this;
		this.initSettings();
		this.loadFlash();
		this.displayDebugInfo()
	} catch (a) {
		delete SWFUpload.instances[this.movieName];
		throw a
	}
};
SWFUpload.instances = {};
SWFUpload.movieCount = 0;
SWFUpload.version = "2.2.0 2009-03-25";

 

1.可见SWFUpload是个function

2.初始化SWFUpload.movieCount = 0;
3.引两遍会造成这个名字冲突

this.movieName = "SWFUpload_" + SWFUpload.movieCount++;

 

解决办法

1.引用一遍

2.修改this.movieName = "SWFUpload_" + b.id

id就是file域的id,id不要重名,(此方法未测)

 

 

你可能感兴趣的:(uploadify,SWFUpload_0)