jq php 多图上传,php+jq实现多图片上传

1.上传显示图片,实时提交文件

function BigFileUpload(showId,fileFormId,delurl,downloadurl){

var fileName = new Array();

var that = this;

$(fileFormId).form({

success:function(data){ //返回信息[['文件名称','完整路径'],['','']...]

// $(showId+" .shadow").css("display","none");

data = eval('(' + data + ')');

$.each(data,function(index,val){

allpath.push(val[1]);

console.log(allpath);

if(index<10){

$(showId).append(cloneFileContent(val));

}

});

console.log(allpath);

}

});

function cloneFileContent(flName){

var temp = $("

" +

"

"

+"close.png

"+

"

").clone();

temp.find(".col_servicePictureImgPreview").attr("src", '../images/'+flName[1]);//find() 方法获得当前元素集合中每个元素的后代,通过选择器、jQuery 对象或元素来筛选。

temp.find(".close").click(function(){

$.post(delurl,{'fileGuid':flName[1]},function(data){

if(data.state=='success'){

console.log(data);

allpath=allpath.filter(function (x) {

return x!=flName[1];

})

console.log(allpath);

temp.remove();

}

},"json")

});

return temp;

};

this.operate = function(input){

$(fileFormId).form("submit");

};

this.getFilenames = function(){

console.log(fileName);

return fileName;

}

}

lessionFileUpload = new BigFileUpload("#col_servicePictureImgDivPreview","#lessionfileForm","{{ path('lessionFileDel') }}","{{ asset('fileUrl') }}");

2.修改信息是实现显示图片每张图片左上角有关闭按钮

if(addressaddress!=''&& addressaddress !=null){

/*本地预览展示*/

console.log(addressaddress);

$.each(addressaddress.split(','),function(index,val){

nowaddress.push(val);

if(index<10){

$("#col_servicePictureImgDivPreview").append(localShowImage(val));

}

});

function localShowImage(address) {

var fulContent=$("

" +

"

"

+"close.png

"+

"

").clone();

fulContent.find(".col_servicePictureImgPreview").attr("src", '../images/'+address);

fulContent.find(".close").click(function(){

$.post('lessionFileDel',{'fileGuid':address},function(data){

if(data.state=='success'){

nowaddress=nowaddress.filter(function (x) {

return x!=address;

})

console.log(nowaddress);

$.post('updatejiyaoaddress',{'address':nowaddress.join(),'meetindid':meetingidf},function () {

},'json')

fulContent.remove();

}

},"json")

});

return fulContent;

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值