axios upload excel file

https://github.com/axios/axios/issues/1660

https://stackoverflow.com/questions/52521274/use-axios-to-get-and-save-an-excel-file

https://serversideup.net/uploading-files-vuejs-axios/

https://www.pluralsight.com/guides/asynchronous-file-upload-react

post formData

axios.post( '/single-file', formData, {
headers: {
'Content-Type': 'multipart/form-data'
},
},
).then(function(){
console.log('SUCCESS!!');
})
.catch(function(){
console.log('FAILURE!!');
});

upload component

https://zzk.cnblogs.com/my/s/blogpost-p?Keywords=upload+excel


postUploadExcel(blob) {
const {
name,
type,
size,
lastModified,
lastModifiedDate,
webkitRelativePath,
} = blob;
// const types = [".xlsx", ".xls", ".csv"];
const types = ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];
const littleSize = Math.ceil(size / 1000) <= 500 ? true : false;
const supportType = types.includes(type) ? true : false;
const seatMapTemplateId = this.templateId;
if (supportType) {
this.isShowWarning = false;
const formData = new FormData();
formData.append('file', blob);
// 不需要 Content-Type, new FormData(), 已经自带了 `multipart/form-data`
fetch(`/opapi/v2/seatMap/template/${seatMapTemplateId}/seatData`, {
method: 'POST',
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded',
// },
// mode: 'cors',// no-cors
// credentials: 'include',
body: formData,
})
.then(res => res.json())
.then(data => {
const {
data: url,
success,
errorHint,
errorCode,
} = data;
if(success) {
this.$message({
message: '上传成功',
type: 'success'
});
this.updateURL(url || ``);
} else {
this.$message({
message: `上传错误: ${errorCode}_${errorHint}`,
type: 'error'
});
}
})
.catch(error => {
this.$message({
message: '上传错误',
type: 'error'
});
console.error(error);
});
} else {
this.isShowWarning = true;
this.$message({
type: 'info',
message: '上传失败,请检查文件大小和类型!'
});
}
},

https://element.eleme.io/#/zh-CN/component/upload

refs



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


axios upload excel file的更多相关文章

  1. input support upload excel only

    input support upload excel only demo https://codepen.io/xgqfrms/pen/vYONpLB <!-- <input placeh ...

  2. NetSuite SuiteScript 2.0 export data to Excel file(xls)

    In NetSuite SuiteScript, We usually do/implement export data to CSV, that's straight forward: Collec ...

  3. Read Excel file from C#

    Common way is: var fileName = string.Format("{0}\\fileNameHere", Directory.GetCurrentDirec ...

  4. csharp:using OpenXml SDK 2.0 and ClosedXML read excel file

    https://openxmlexporttoexcel.codeplex.com/ http://referencesource.microsoft.com/ 引用: using System; u ...

  5. Creating Excel File in Oracle Forms

    Below is the example to create an excel file in Oracle Forms.Pass the Sql query string to the below ...

  6. Formatting Excel File Using Ole2 In Oracle Forms

    Below is the some useful commands of Ole2 to format excel file in Oracle Forms.-- Change font size a ...

  7. Read / Write Excel file in Java using Apache POI

    Read / Write Excel file in Java using Apache POI 2014-04-18 BY DINESH LEAVE A COMMENT About a year o ...

  8. How to upload a file in MVC4

    Uploading a file in Asp.Net MVC application is very easy. The posted file is automatically available ...

  9. The 13th tip of DB Query Analyzer, powerful processing EXCEL file

    The 13thtip of DB Query Analyzer, powerful processing EXCEL file MA Genfeng (Guangdong UnitollServic ...

随机推荐

  1. 2021年,python的入门基础-----基础一

    先记录下pycharm编译器相关的信息 1.某些常用快捷键: Ctrl+/ 注释: Tab缩进,shift+Tab; Ctrl+Z 撤销 2.设置界面编辑风格: File>Settings> ...

  2. JavaWeb——Ajax与MVC学习总结

    Ajax: 什么是Ajax? 为什么使用Ajax? 使用jquery Ajax实现登录 Ajax实例练习: 设计模式 设计模式的定义: 设计模式的作用: MVC设计模式 MVC设计模式的模块组成: M ...

  3. Hive on MR调优

    当HiveQL跑不出来时,基本上是数据倾斜了,比如出现count(distinct),groupby,join等情况,理解 MR 底层原理,同时结合实际的业务,数据的类型,分布,质量状况等来实际的考虑 ...

  4. 7.DHCP的相关命令

    1.Get-DhcpServerv4Scope :查看所有作用域状态 PS C:\Users\xinghen> Get-DhcpServerv4Scope ScopeId SubnetMask ...

  5. 设计模式(十二)——享元模式(Integer缓冲池源码分析)

    1 展示网站项目需求 小型的外包项目,给客户 A 做一个产品展示网站,客户 A 的朋友感觉效果不错,也希望做这样的产品展示网站,但是要求都有些不同: 1) 有客户要求以新闻的形式发布 2) 有客户人要 ...

  6. 最短Hamilton路径(状压dp)

    最短Hamilton路径实际上就是状压dp,而且这是一道作为一个初学状压dp的我应该必做的题目 题目描述 给定一张 n(n≤20) 个点的带权无向图,点从 0~n-1 标号,求起点 0 到终点 n-1 ...

  7. 【poj 2752】Seek the Name, Seek the Fame(字符串--KMP)

    题意:给出一个字符串str,求出str中存在多少子串,使得这些子串既是str的前缀,又是str的后缀.从小到大依次输出这些子串的长度. 解法:利用KMP中next[ ]数组的性质,依次找到前缀.后缀匹 ...

  8. 【noi 2.6_9289】Ant Counting 数蚂蚁{Usaco2005 Nov}(DP)

    题意:有M个家族的蚂蚁,各Ni只(互相相同).问选出 l~r 只的不同方案数. 解法:很基础的一种DP,不要被"排列组合"所迷惑了啊~我之前接触过这个类型,可惜又忘了,一定要记住! ...

  9. Vitya and Strange Lesson CodeForces - 842D 字典树+交换节点

    题意: Today at the lesson Vitya learned a very interesting function - mex. Mex of a sequence of number ...

  10. .Net反编译实践记录

    去壳 去壳可以使用 de4dot,源码在 这里.可用版本 下载地址. 使用方式为:.\de4dot.exe [path] 修改代码 反编译修改代码可以使用 dnSpy,源码在 这里.可用版本 下载地址 ...