Jquery.uploadify在遨游中多选文件上传第一个后停止,IE正常,已经尝试了uploadify.swf?V='+(new Date()).getTim

hanguoji84 2012-03-27 10:24:43
请大家帮忙谢谢,遨游多文件上传不可用只能传成功第一个,就终止了,之后就没响应了,IE8多文件上传好使,该引用的JS都引用了v2.1.4.min.js版本,代码如下:

//按钮触发保存文件
function SaveFile() {
var strPath = $("#txtParent_2").html();
strPath = '../UserFile/InfoManage/' + strPath;
var strID = $("#txtID").val();
var strUserID = $("#txtUserID").val();
var strCorpCode = $("#txtCorpCode").val();
var strScript = '../CheckCode/FileManage.aspx?Mode=AddFile&DirID='+strID+"&Corp="+strCorpCode+"&UserID="+strUserID;
//'script': '../CheckCode/FileManage.aspx?Mode=AddFile&DirID='+$("#txtID").val(),
$('#uploadify').uploadifySettings('script', strScript);
//'folder': '../UserFile/'+strPath,
$('#uploadify').uploadifySettings('folder', strPath);
$('#uploadify').uploadifyUpload();
document.getElementById('apDiv8').style.display = "none";
document.getElementById('divUpFile').style.display = "none";
}


$(document).ready(function() {
$("#uploadify").uploadify({
'uploader': '../../Js/JQuery/uploadify.swf?V='+(new Date()).getTime(),
'height': '26',
'width': '74',
'buttonImg': '../../Images/Manage/xzwj.jpg',
'cancelImg': '../../Images/Manage/cancel.png',
'queueID': 'fileQueue',
//'fileDesc': '*.rar;*.jpg;*.gif',
//'fileExt': '*.rar;*.jpg;*.gif',
'sizeLimit': '400097152', //400M
'auto': false,
'multi': true,
'onError': function(a, b, c, d) {
if (d.status == 404)
alert('Could not find upload script.');
else if (d.type === "HTTP")
alert('error ' + d.type + ": " + d.status);
else if (d.type === "File Size")
{ }
},
'onComplete': function(event, queueID, fileObj, response, data) {
if (response == "0") {
alert("上传附件出错,请重试");
return;
}
var strName = fileObj.name;
/*iNum++;
var len = fileObj.size;
len = Math.round(len/1024*100)*0.01;
var m="KB";
if(len>1000)
{len=Math.round(len*0.001*100)*0.01;m="MB";}
len = len.toString() + m;
var htm="<div id=\"fileItem"+iNum+"\"><img src=\"../../Images/Manage/fj.jpg\" alt=\"附件\" border=\"0\" />"+fileObj.name+"("+len+")    <a href=\"javascript:void(0);\" onclick=\"DelFile("+iNum+",'" + escape(strName)+"','../UserFile/"+strID+"')\"><img src=\"../../Images/Manage/sc.gif\" alt=\"删除\" border=\"0\"/></a></div>";
$("#fileUploaded").append(htm);*/

document.getElementById("fileQueue").style.display = "none";
var txtFileID = $("#txtTmp").val();
$("#txtTmp").val(txtFileID + "," + response);
var iTmp = strName.lastIndexOf(".");
if (iTmp > 0) {
strName = strName.substring(0, iTmp);
}
AddFileInfo(response, strName);
}
});
});
...全文
291 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
hanguoji84 2012-03-29
  • 打赏
  • 举报
回复
你的例子我试过了,遨游可行,十分感谢,我找了好几天的问题,终于知道原因了,在它上传多文件的过程中,不能把它所属的DIV或者它DIV内部的东西隐藏,否则就会报错找不到,我是在onComplete中做了一些操作才导致遨游在上传一个文件后对其他DIV和它本身的DIV做了操作导致的。十分感谢!
SomethingJack 2012-03-27
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 hanguoji84 的回复:]

你给我的这个例子好用,我看看能不能替换一下我的代码,十分感谢,先给分,如果有需要请教的,还得麻烦您!十分感谢!!!!!!
[/Quote]
不客气`
hanguoji84 2012-03-27
  • 打赏
  • 举报
回复
你给我的这个例子好用,我看看能不能替换一下我的代码,十分感谢,先给分,如果有需要请教的,还得麻烦您!十分感谢!!!!!!
SomethingJack 2012-03-27
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 hanguoji84 的回复:]

谢谢,我的邮箱是:hanguoji@vip.qq.com 主要是这次附带了几个参数,所以不能再ready中直接配置好:
var strScript = '../CheckCode/FileManage.aspx?Mode=AddFile&DirID='+strID+"&Corp="+strCorpCode+"&UserID="+strUserID;
……
[/Quote]
DEMO已经发给你 你先在你的遨游上试试
hanguoji84 2012-03-27
  • 打赏
  • 举报
回复
谢谢,我的邮箱是:hanguoji@vip.qq.com 主要是这次附带了几个参数,所以不能再ready中直接配置好:
var strScript = '../CheckCode/FileManage.aspx?Mode=AddFile&DirID='+strID+"&Corp="+strCorpCode+"&UserID="+strUserID;
//'script': '../CheckCode/FileManage.aspx?Mode=AddFile&DirID='+$("#txtID").val(),
$('#uploadify').uploadifySettings('script', strScript);
//'folder': '../UserFile/'+strPath,
$('#uploadify').uploadifySettings('folder', strPath);
$('#uploadify').uploadifyUpload();
hanguoji84 2012-03-27
  • 打赏
  • 举报
回复
我也增加在这里了:var strScript = '../CheckCode/FileManage.aspx?V='+(new Date()).getTime()

但还是不好使,
请问你有什么解决办法么?
SomethingJack 2012-03-27
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 mngzilin 的回复:]

uploadify.swf是flex制作的,利用里面的FileReferenceList控件,但是这个控件在多文件上传时,是遍历文件并单个请求上传,也就是同时上传多个文件,多次请求aspx.ashx,但是aspx/ashx每次只能接收到一个,是多次完成的。

至于你这句 'uploader': '../../Js/JQuery/uploadify.swf?V='+(new Date()).g……
[/Quote]
你换个版本试试 再有问题的话留个邮箱我发个DEMO你看看。yefeng85862375@126.com 我的邮箱
mngzilin 2012-03-27
  • 打赏
  • 举报
回复
uploadify.swf是flex制作的,利用里面的FileReferenceList控件,但是这个控件在多文件上传时,是遍历文件并单个请求上传,也就是同时上传多个文件,多次请求aspx.ashx,但是aspx/ashx每次只能接收到一个,是多次完成的。

至于你这句 'uploader': '../../Js/JQuery/uploadify.swf?V='+(new Date()).getTime(),
加上getTime()等于没加,你在ready事件中getTime只执行了一次,没有差别

62,268

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧