axios upload excel file
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的更多相关文章
- input support upload excel only
input support upload excel only demo https://codepen.io/xgqfrms/pen/vYONpLB <!-- <input placeh ...
- 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 ...
- Read Excel file from C#
Common way is: var fileName = string.Format("{0}\\fileNameHere", Directory.GetCurrentDirec ...
- csharp:using OpenXml SDK 2.0 and ClosedXML read excel file
https://openxmlexporttoexcel.codeplex.com/ http://referencesource.microsoft.com/ 引用: using System; u ...
- 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 ...
- 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 ...
- 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 ...
- How to upload a file in MVC4
Uploading a file in Asp.Net MVC application is very easy. The posted file is automatically available ...
- 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 ...
随机推荐
- goroutine 分析 协程的调度和执行顺序 并发写 run in the same address space 内存地址 闭包 存在两种并发 确定性 非确定性的 Go 的协程和通道理所当然的支持确定性的并发方式(
package main import ( "fmt" "runtime" "sync" ) const N = 26 func main( ...
- <script>元素
简介 向HTML页面中插入JavaScript的主要方法,就是使用'<'script'>'元素. 标签的位置 现代Web应用程序一般都把全部的JavaScript饮用放在'<'bod ...
- COGS 307 模拟退火
307. [HAOI2006] 均分数据 ★★ 输入文件:data.in 输出文件:data.out 简单对比时间限制:3 s 内存限制:128 MB [问题描述] 已知N个正整数:A ...
- 为什么在使用LESS 除法计算时会出问题
hello,各位小伙伴们好,最近一直有小伙伴问我为什么写Less的时候,发现除法有了问题,在生成的css文件中,不给我们输出正确结果了. 直接抛结论: LESS 版本升级,EasyLess插件 新版本 ...
- FunnyXEN
For any positive integer n, we define function F(n) and XEN(n).For a collection S(n)={1,2,...,2n}, w ...
- 阅读笔记:ImageNet Classification with Deep Convolutional Neural Networks
概要: 本文中的Alexnet神经网络在LSVRC-2010图像分类比赛中得到了第一名和第五名,将120万高分辨率的图像分到1000不同的类别中,分类结果比以往的神经网络的分类都要好.为了训练更快,使 ...
- Codeforces Round #640 (Div. 4)
比赛链接:https://codeforces.com/contest/1352 A - Sum of Round Numbers 题意 将一个十进制数的每一个非零位分离出来. 代码 #include ...
- AtCoder Beginner Contest 164
比赛链接:https://atcoder.jp/contests/abc164 A - Sheep and Wolves #include <bits/stdc++.h> using na ...
- 2020-2021 ICPC, NERC, Southern and Volga Russian Regional Contest (Online Mirror, ICPC Rules) D. Firecrackers (贪心,二分)
题意:有个长度为\(n\)的监狱,犯人在位置\(a\),cop在位置\(b\),你每次可以向左或者向右移动一个单位,或者选择不动并在原地放一个爆竹\(i\),爆竹\(i\)在\(s[i]\)秒后爆炸, ...
- poj3083 Children of the Candy Cor
Description The cornfield maze is a popular Halloween treat. Visitors are shown the entrance and mus ...