2022年2月3日

URL.createObjectURL(File),URL.revokeObjectURL(url)

摘要: URL对象可以通过createObjectURL(any)方法来将任意内容any用一个地址来表示 栗子: <input type="file" id="F" /> let F = document.getElementById('F') F.onchange = function(event) { 阅读全文

posted @ 2022-02-03 17:51 In-6026 阅读(140) 评论(0) 推荐(0)

File,Blob,FileReader,ArrayBuffer,TypeArray,DataView

摘要: File就是用户计算机上的文件,一般通过<input type="file" />标签来使用户选择文件,选择后可以知道文件的大小,名称,类型等基础信息 File长这样,是个对象 Blob是Binary large Object缩写,人话:它是一个不可变的,包含二进制数据的,类文件对象(即:像是上面那 阅读全文

posted @ 2022-02-03 11:45 In-6026 阅读(96) 评论(0) 推荐(0)

(payload too large)expressJs上传文件大小受限解决方法

摘要: 安装第三方模块body-parser npm i body-parser 然后在app.js中 let bodyParser = require('body-parser') app.use(bodyParser.json({ limit: '2mb' }))//此处为2MB,可改 app.use( 阅读全文

posted @ 2022-02-03 10:58 In-6026 阅读(191) 评论(0) 推荐(0)

前端文件下载

摘要: ###a标签download属性实现下载 缺点:只能下载同一个ip,端口下的文件,不能跨域(不论被下载文件的后端允不允许跨域,都不行) <a download href="#"></a> ###后端实现,nodeJs的expressJs框架为例 访问该地址就会打开系统文件夹,提示下载,不会显示要下载 阅读全文

posted @ 2022-02-03 04:42 In-6026 阅读(70) 评论(0) 推荐(0)

导航