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