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. pthon之变量

    1.变量由三部分组成: 变量名  =   值 如:name = 'xiaohan'     sex='男'   age = 20 2.变量名的规范 2.1 变量名只能是字母,数字或下划线的任意组合 2 ...

  2. 快速计算C(n,r)

    在网上见的,引用出处为:http://blog.csdn.net/alexingcool/article/details/7997599 可以在logn内计算出,但是容易溢出. [cpp] view ...

  3. python 百分比的计算打印

    在做压测的时候常常需要统计测试成功率,简单的例子如下: count = 89i = 100print("測試次數:%d"%count)print("測試成功率:%.2f% ...

  4. linux查看log

    TOMCAT_PATH='/home/jyapp/apache-tomcat-7.0.59/'PID=`ps -ef |grep $TOMCAT_PATH | grep -v grep |awk '{ ...

  5. IP路由__距离矢量路由选择协议

    矢量路由选择协议 1.距离矢量路由选择算法发送完整的路由选择表到相邻的路由器,然后,相邻的路由器会将接收到的路由表项与自己原有的路由表进行组合,以完善路由器的路由表. 由于路由器接收到的更新只是来自相 ...

  6. ElasticSearch的查询(二)

    一.Query String search 添加测试数据 PUT test_search { "mappings": { "test_type": { &quo ...

  7. c++bind函数使用

    总述     最近写代码的时候看到代码使用了bind,一个参数绑定的标准库函数.程序是这么写的, speaker_play_routine_ = new boost::thread (boost::b ...

  8. Java多线程Condition定点通知

    多线程之间按顺序调用,实现A->B->C三个线程启动,要求如下:A打印5次,B打印10次,C打印15次接着 A打印5次,B打印10次,C打印15次 来10轮 package com.yan ...

  9. HDU4467 Graph【轻重点维护】

    HDU4467 Graph 题意: 给出一张染色图,\(n\)个点每个点是黑色或者白色,\(m\)条带权边,\(q\)次操作,有两种操作: 改变一个点的颜色 问所有边中两个端点的颜色为给定情况的边权和 ...

  10. Luogu P2408 不同子串个数【SAM】

    P2408 不同子串个数 计算一个字符串的不同子串个数 两种方法,一种是\(dp\)出来\(SAM\)从起点开始的路径数量 另一种方法就是计算每个点的\(len[i]-len[link[i]]\)这个 ...