我想上傳帶有標題和鏈接的多個文件。代碼是:使用uplodify進行多文件上傳
$(document).ready(function()
{
$('#divUpload').uploadify(
{
'uploader': 'admin/fileupload/uploadify.swf',
'script': 'admin/home-banner-list.aspx?process=fileupload',
'multi' : 'true',
'method' : 'POST',
'cancelImg' :'admin/images/cancel.png',
'folder': '../source/BannerImage',
'queueSizeLimit' : '20',
'fileDesc' : '*.JPEG;*.JPG;*.GIF;*.PNG;*.BMP',
'fileExt': '*.JPEG;*.JPG;*.GIF;*.PNG;*.BMP',
'wmode' : 'transparent',
'onCancel':function(event,queueID,fileObj,data)
{
if(data['fileCount']==0)
{
txtboxIndex=0;
$('#btnUploadfile').hide();
$('#btnCancelUploadfile').hide();
}
else
{
txtboxIndex=txtboxIndex-1;
}
},
'onAllComplete': function(event,data)
{
jQuery('#'+divMsg).css('display','');
jQuery('#'+divMsg).html('Banner(s) has been uploaded successfully.').attr('class','successmsg');
window.setTimeout("window.location.href='admin/home-banner-list.aspx'",2000);
},
'onSelect' : function(event,queueid,fileObj)
{
$('#btnUploadfile').show();
$('#btnCancelUploadfile').show();
},
'onComplete': function(event,queueID,fileObj,response,data)
{
if(response=='maxupload')errcnt++;
}
})
});
function CancelUpload()
{
$('#divUpload').uploadifyClearQueue();
if(jQuery('.uploadifyQueueItem').length>0)
DisplMsg('<%= divMsg.ClientID %>','Banner(s) upload has been cancelled.','msgerror');
window.setTimeout("window.location.href='admin/home-banner-list.aspx'",2000);
}
function UploadFiles()
{
var cnt='';
var str='';
$('.tbxLink').each(function(index)
{
if(jQuery.trim($(this).val())!='')
{
if(!isValidURL(jQuery.trim($(this).val())))
{
if(cnt.length ==0)
cnt=(index + 1);
else
cnt=cnt + ',' +(index + 1);
}
}
});
if(cnt.length!=0)
{
alert('Please insert valid link in image#' + cnt);
return false;
}
$('.txttitle').each(function(index)
{
cnt= $(this).attr('name').replace('txttitle','');
str =str + ',\'' + $(this).attr('name') + '\':\'' + $(this).val() + '\'';
str =str + ',\'' + 'tbxLink' + cnt + '\':\'' + $('#tbxLink' + cnt).val() + '\'';
str= str + ',\'' + cnt + '\':\'' + $('#hdnfile'+ cnt).val() + '\'';
});
str = str.substring(1);
str='{' + str + '}';
$('#divUpload').uploadifySettings('scriptData', str ,false);
$('#divUpload').uploadifyUpload();
}
此代碼工作文件在IE中,但在Firefox中無法正常工作。 在Firefox下面的腳本不叫
'腳本': '?管理/家庭橫幅list.aspx過程=文件上傳'
您在錯誤控制檯中遇到什麼錯誤? – 2010-12-10 10:58:18
沒有得到任何錯誤。 'onAllComplete'被調用並且頁面也被重定向。 – Jayesh 2010-12-10 11:20:14