$(document).ready(function(){
var isFF = "";
if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){
isFF = "?isFirefox=true";
}
$("#file_upload").uploadify({
swf : '${staticPath}/js/uploadify/uploadify.swf',
uploader : '${CP}/servlet/multi_file_upload' + isFF,
height : 24,
width : 204,
multi : false,
auto : true,
removeCompleted:false,
buttonText : '选择文件上传',
fileObjName :'the_files',
fileTypeDesc :'mp4',
queueID :'queue',
fileTypeExts :'*.mp4',
progressData : 'speed',
queueSizeLimit:1,
//fileSizeLimit : 'maxFileSize',
fileSizeLimit : '0',
method :'post',
onFallback :function(){
alert("您的浏览器不支持Flash,请更新或安装最新版Flash后再试。");
},
onCancel : function(file) {
alert(file.name + '文件被取消');
},
onUploadStart : function(file) {
$("#file_upload").uploadify("disable",true);
},
onUploadSuccess : function(file, data, response){
alert(file.name+file.id + "\n\n" + response + "\n\n" + data);
var obj =JSON.parse(data);
$("#"+file.id).attr("data-code",obj.code);
}
});
})
上传视频的时候,已经成功上传到服务器,后台multi_file_upload方法也获取到前台传入的视频code(中途会断掉,然后继续执行方法,最终可以返回code到前台),但是没等到code出来,前台却已经执行了uploadify的onUploadSuccess方法,从而导致data为空,这该怎么解决呢?希望有遇到过并已经解决的同仁们给个意见,感激不尽。