您的位置:首页 > Web前端 > JQuery

Js上传图片 jquery:ajaxfileupload和angular:angular-file-upload

2016-12-20 09:29 751 查看

jquery

jquery无刷新上传图片可使用ajaxfileupload插件,其中可能遇到的错误

Uncaught TypeError: jQuery.handleError is not a function
上传出错时才会出现

只要在ajaxfileupload.js中添加

handleError: function( s, xhr, status, e )      {
// If a local callback was specified, fire it
if ( s.error ) {
s.error.call( s.context || s, xhr, status, e );
}

// Fire the global callback
if ( s.global ) {
(s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );
}
},


angular

可以参考 https://github.com/nervgh/angular-file-upload 中的demo

效果图



代码地址 https://github.com/halfopen/frontend-demos/tree/master/upload-image
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息