单纯上传图片
//上傳頭像$('.j-file').on('change', function(e) {if(!window.FileReader) return;var files = e.target.files;var content = '';for(var i = 0, f; f = files[i]; i++) {if(!f.type.match('image.*')) {alert('文件' + f.name+'不是圖片')continue;}var reader = new FileReader();reader.onload = function(e) {content = ' <img src="' + e.target.result + '" width="70" height="70">';$('.j-file').parent().find('.img').replaceWith(content);}reader.readAsDataURL(f);}});
?
轉載于:https://www.cnblogs.com/ouchen0312/p/7543750.html
總結
- 上一篇: python Unable to fin
- 下一篇: Unity3D之主角面朝方向一定区域内对