blob

HTML5 File API

喜你入骨 提交于 2020-02-16 04:41:04
HTML5 引入了一个 File API 用以提供用户上传文件的信息,并允许网页中的 JavaScript 访问其内容。 以下是一些表单 file 控件: <input type="file" accept="video/*;capture=camcorder"> <input type="file" accept="audio/*;capture=microphone"> <input type="file" accept="image/*;capture=camera">直接调用相机(测试安卓可以,iphone还是有相册) <input type="file" accept="image/*" />调用相机 图片或者相册 <input type="file" multiple accept="image/*" />调用相册 1 FileList 对象 FileList 对象针对表单的 file 控件。 当用户通过 file 控件选取文件后,这个控件的 files 属性值就是 FileList 对象。 // 多选控件 <input type='file' multiple /> <script> document.querySelector('input').onchange = function() { console.log(this.files); }; </script>

Element-ui组件库Table表格导出Excel表格

浪尽此生 提交于 2020-02-13 22:26:31
安装 npm install --save xlsx file-saver 两个插件的详细地址在下面 https://github.com/SheetJS/js-xlsx https://github.com/eligrey/FileSaver.js 代码部分(有注释解释说明) <template> <div class="table"> <!--给表格添加一个id,导出文件事件需要使用--> <el-table :data="tableData" border style="width: 100%" id="out-table" > <el-table-column prop="date" label="日期" width="180" > </el-table-column> <el-table-column prop="name" label="姓名" width="180" > </el-table-column> <el-table-column prop="address" label="地址" > </el-table-column> </el-table> <!--给按钮绑定事件--> <button @click="exportExcel">点击导出</button> </div> </template> <script> // 引入导出Excel表格依赖

multiple blob file insertion php

混江龙づ霸主 提交于 2020-02-08 06:32:11
问题 i have a form where the user inputs his info and has the ability to insert more than 1 longblob file (either an image or another file such as pdf), the insertion isn't working yet, but i'm able to manually insert file in MySQL and retrieve it ( View / download ), the attachment is to be uploaded to an "Attachment" Table and into a column "attachment" in Customer table, here's a code snippet of what is achieved: <?php function insertFile_db($myFile,$conn,$tablename,$id){ $fileCount = count(

multiple blob file insertion php

蹲街弑〆低调 提交于 2020-02-08 06:29:26
问题 i have a form where the user inputs his info and has the ability to insert more than 1 longblob file (either an image or another file such as pdf), the insertion isn't working yet, but i'm able to manually insert file in MySQL and retrieve it ( View / download ), the attachment is to be uploaded to an "Attachment" Table and into a column "attachment" in Customer table, here's a code snippet of what is achieved: <?php function insertFile_db($myFile,$conn,$tablename,$id){ $fileCount = count(

ajax实现文档导出及下载

只谈情不闲聊 提交于 2020-02-07 06:50:38
做导出一直遇到个问题就是不能用ajax实现一步导出文档,即导出加下载。今天突然想到可以分开来做就上网搜了下,发现一篇比较不错的文章( http://www.cnblogs.com/zj0208/p/5961181.html ),先摘录下来。 问题说明:Ajax是无法实现文件传输的,本文只是模拟了Ajax不刷新页面就可以请求并返回数据的效果。实质上还是通过提交form表单来返回文件流的输出。 分步实现逻辑: ajax请求服务器,访问数据库,根据查询到的数据生成一个数据文件,返回前台一个json对象(可放置生成成功标记,文件路径等信息)。 ajax success回调函数部分,根据返回的json对象,调用手写的js下载文件的方法,实现页面无刷新下载文件。 贴上部分代码供参考: js代码: 1. js写一个动态创建并提交form表单的方法,依赖于 jQuery 插件。 // 文件下载 jQuery.download = function (url, method, filedir, filename) { jQuery('<form action="' + url + '" method="' + (method || 'post') + '">' + // action请求路径及推送方法 '<input type="text" name="filedir" value="' +

Understanding cast from bytea to oid

妖精的绣舞 提交于 2020-02-05 04:36:47
问题 I'm using PostgreSQL 9.2 . This blog entry by Grace Batumbya provides a cast from bytea to oid . create or replace function blob_write(lbytea bytea) returns oid volatile language plpgsql as $f$ declare loid oid; lfd integer; lsize integer; begin if(lbytea is null) then return null; end if; loid := lo_create(0); lfd := lo_open(loid,131072); lsize := lowrite(lfd,lbytea); perform lo_close(lfd); return loid; end; $f$; CREATE CAST (bytea AS oid) WITH FUNCTION blob_write(bytea) AS ASSIGNMENT;

web前端:文件下载

余生长醉 提交于 2020-02-05 04:29:31
// 返回二进制 var xhr = new XMLHttpRequest ( ) ; xhr . open ( "GET" , ` ${ url } /web/showWordDownload?companyId= ${ that . companyId } ` , true ) ; xhr . responseType = "blob" ; xhr . onload = function ( e ) { let content = xhr . response ; let blob = new Blob ( [ content ] , { type : "application/pdf" } ) ; let explorer = window . navigator . userAgent ; if ( explorer . indexOf ( "Trident" ) < 0 ) { let a = document . createElement ( "a" ) ; a . download = "工控系统安全加固建议报告.docx" ; a . style . display = "none" ; a . href = URL . createObjectURL ( blob ) ; document . body . appendChild ( a ) ; a .

Javascript实现页面内容下载

◇◆丶佛笑我妖孽 提交于 2020-02-04 12:20:43
https://www.awaimai.com/259.html 页面上有一段代码,要保存下来,怎么做? 选择复制?用按钮请求数据库?都很低效。 既然页面已经有了内容,为何不用JS获取这段代码,生成文件后直接下载? 下面我们用 Blob 和 URL.createObjectURL 来实现这一功能,兼容Chrome、Firefox和IE等主流浏览器。 1 演示 点击查看演示地址。 2 实现代码 JS代码如下,已经封装成一个函数,filename是保存的文件名,content是保存到这个文件中的内容: function download ( filename , content ) { var blob = new Blob ( [ content ] , { type : 'text/plain' } ) ; var url = window . URL . createObjectURL ( blob ) ; var a = document . createElement ( 'a' ) ; a . style = "display: none" ; a . href = url ; a . download = filename ; document . body . appendChild ( a ) ; a . click ( ) ; setTimeout (

web页面提供blob数据下载

ぃ、小莉子 提交于 2020-02-04 12:17:27
(function(w){ w.downloadBlob = function download(blob,fileName){ const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.style.display = 'none'; a.href = url; a.download = fileName; document.body.appendChild(a); a.click(); } })(window); const downloadButton = document.querySelector('a#download'); downloadButton.onclick = function(){ var blob = new Blob(['我是Blob'],{type: 'text/html'}); downloadBlob(blob,'test.html'); }; 文件类型: html:text/html pdf:application/pdf 来源: https://www.cnblogs.com/nomarker/p/12258824.html

Git内部原理探索

人走茶凉 提交于 2020-02-03 02:14:21
目录 前言 Git分区 .git版本库里的文件/目录是干什么的 Git是如何存储文件信息的 当我们执行git add、git commit时,Git背后做了什么 Git分支的本质是什么 HEAD引用 参考 @ 前言 洞悉技术的本质,可以让我们在层出不穷的框架面前仍能泰然处之。用了那么久的 Git,不懂点内部原理,那可不行!懂点原理可以让我们遇到问题的时候能够更好更快的理清解决问题的思路。 博客原文 要真正读懂本文可能需要以下基础: 有 Git 使用经验 对 Git 的三个分区有所了解 熟悉常用的 Linux 命令 对经典哈希算法有一定的了解,比如 SHA-1 、SHA-256、MD5等 在开始之前,让我们先抛出几个问题,然后一一解决、回答它们 .git版本库里的文件/目录是干什么的? Git是如何存储文件信息的? 当我们执行git add、git commit时,Git背后做了什么? Git分支的本质是什么? Git分区 在真正开始之前,让我们先回顾下Git的三个分区(Workspace、Index / Stage、git repository) 工作区(Workspace):此处进行代码文件的编辑 索引或称暂存区(Index / Stage):存储文件状态信息,进行commit前会对此时的文件状态作快照(Snapshot) Git版本库(git repository):由Git