uploadify上传图片的使用

一:引用jquery.uploadify.js

二:代码

<body>
<table>
<tr>
<td style="width: 15%; text-align: right">
<a id="pub_upload" href="#" class="easyui-linkbutton" iconcls="icon-ok" οnclick="javascript:$('#uploadify').uploadify('upload','*')">上传</a>
</td>
<td style="width: 35%; text-align: left">
<a id="pub_cancel" href="#" class="easyui-linkbutton" iconcls="icon-cancel" οnclick="javascript:;$('#uploadify').uploadify('cancel')">取消</a>
</td>
</tr>
</table>
<div style="padding-left:80px;">
<input type="file" name="uploadify" id="uploadify"/>
</div>
<div id="fileQueue"></div>
</body>


<script>
$(function () { 

upload(value);
});

function upload(userid) {
$("#uploadify").uploadify({
'height': 30,
'swf': '@Url.Content("~/Scripts/js/uploadify/uploadify.swf")',
'uploader': '@Url.Action("Upload")',
'width': 120,
'cancel': '@Url.Content("~/Scripts/js/uploadify/uploadify.png")',
'buttonText': '选择文件',
'fileTypeExts': '*.bmp;*.doc;*.docx;*.gif;*.jpeg;*.jpg;*.pdf;*.png;*.ppt;*.pptx;*.rar;*.txt;*.zip;*.tif;*.xls;*.xlsx',
'fileSizeLimit': '10240KB',
'formData': { 'flagID': '1' },
//'folder': 'UploadFile',
//'queueID': 'fileQueue',
'auto': false, //设置为true当选择文件后就直接上传了,为false需要点击上传按钮才上传
'multi': true, //设置为true或false来控制是否可以进行多文件上传
'queueSizeLimit': 15,
'onUploadStart': function () {
//if (userid == "") {
// $("#uploadify").uploadify('stop');
//}
$("#uploadify").uploadify('settings', 'formData', { 'userid': userid });
},
'onUploadSuccess': function (file, data, response) {
if (data != "ok") {
alert(data);
return false;
}
},
'onUploadError': function (file, errorCode, errorMsg, errorString) {
// alert('文件:' + file.name + ' 取消上传');
return false;
}
});
}

</script>

 

 

 

 

使用uploadify上传图片时出现错误:“Cannot read property 'queueData' of undefined”

原来是浏览器原因

https://www.cnblogs.com/ant-jmf17/p/7127756.html

转载于:https://www.cnblogs.com/w1-y2-q5/p/9708885.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值