摘要: <body> <input type="file" id="file" name="" /> <div id="image" style="width:390px;height:280px; background:#CCCCCC; float:left;"> <img src="11.png" /> 阅读全文
posted @ 2018-11-29 18:11 岑丰涛 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 前端: 通过Ajax方式上传文件,使用FormData进行Ajax请求。上传文件或图片时,要求的格式为enctype ="multipart/form-data"(以二进制格式上传),在使用ajax上传时需要注意。 html代码: js代码: 当上传完成,我们可以拿到控制台的信息: Content- 阅读全文
posted @ 2018-11-29 18:03 岑丰涛 阅读(5589) 评论(0) 推荐(0) 编辑
摘要: 1.Whoops, looks like something went wrong. 2.当使用post提交数据时 报The page has expired due to inactivity. Please refresh and try again. 3.Call to undefined f 阅读全文
posted @ 2018-11-29 17:58 岑丰涛 阅读(1042) 评论(0) 推荐(0) 编辑
摘要: web字体体积大导致加载过慢,对于前端来说是一大需要解决的问题,作为一个前端小白,看不懂文档也是个通病,不过还是花了一些时间和朋友一起研究了这个问题,并找到了解决方案就是“字蛛”。 字蛛网站:http://font-spider.orgGitHub源码:https://github.com/aui/ 阅读全文
posted @ 2018-11-29 17:57 岑丰涛 阅读(916) 评论(0) 推荐(0) 编辑
摘要: 此前有同事跟我聊过关于移动端用canvas压缩图片后再上传的功能,最近有了点空闲时间,所以就实践了一下。demo效果链接在文章底部贴出。 在做移动端图片上传的时候,用户传的都是手机本地图片,而本地图片一般都相对比较大,拿iphone6来说,平时拍很多图片都是一两M的,如果直接这样上传,那图片就太大了 阅读全文
posted @ 2018-11-29 17:43 岑丰涛 阅读(1367) 评论(0) 推荐(0) 编辑