post upload file & application/x-www-form-urlencoded & multipart/form-data
post upload file
application/x-www-form-urlencoded
&multipart/form-data
https://stackoverflow.com/a/4073451/5934465
fetch
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new FormData(postData)
})
if (supportType) {
this.isShowWarning = false;
const formData = new FormData();
// formData.append('name', name);
// formData.append('prefix', "areaImg");
formData.append('file', blob);
// const url = `/opapi/v2/seatMap/template/${seatMapTemplateId}/seatTable`;
// axios
// .post(url, options)
// .then(json => {
// const {
// status,
// data,// templateId
// } = json;
// if (status === 200) {}
// });
fetch(`/opapi/v2/seatMap/template/${seatMapTemplateId}/seatTable`, {
method: 'POST',
// headers: {
// // 'Content-Type': 'multipart/form-data',// FormData auto add Content-Type bug!
// },
// 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://github.com/github/fetch/issues/263
https://github.com/axios/axios/issues/362
axios
四种 POST 提交数据方式
https://imququ.com/post/four-ways-to-post-data-in-http.html
Axios
https://stackoverflow.com/questions/43013858/how-to-post-a-file-from-a-form-with-axios
https://segmentfault.com/a/1190000015261229
https://medium.com/@rajajawahar77/content-type-x-www-form-urlencoded-form-data-and-json-e17c15926c69
post upload file & application/x-www-form-urlencoded & multipart/form-data的更多相关文章
- 通过iframe 实现upload file无刷新
<html> <head> </head> <body> <form encType="multipart/form-data&q ...
- Express web框架 upload file
哈哈,敢开源,还是要有两把刷子的啊 今天,看看node.js 的web框架 Express的实际应用 //demo1 upload file <html><head><t ...
- 页面无刷新Upload File
页面无刷新Upload File. 利用jquery.form.js的ajaxForm提交文件. 具体参考以下代码: 前台html <%@ Page Language="C#" ...
- jQuery文件上传插件jQuery Upload File 有上传进度条
jQuery文件上传插件jQuery Upload File 有上传进度条 jQuery文件上传插件jQuery Upload File,插件使用简单,支持单文件和多文件上传,支持文件拖拽上传,有进度 ...
- Upload file
<h3>Upload File</h3> <form action="@Url.Action("Upload","UploadCo ...
- Angular HttpClient upload file with FormData
从sof上找到一个example:https://stackoverflow.com/questions/46206643/asp-net-core-2-0-and-angular-4-3-file- ...
- ERROR! The server quit without updating PID file (/application/mysql-5.6.40/data/db01-51.pid).
centos7.5 安装mysql数据库报错 问题: [root@db01-51 scripts]# /etc/init.d/mysqld start Starting MySQL.Logging t ...
- apache php upload file
/********************************************************************************* * apache php uplo ...
- fetch API & upload file
fetch API & upload file https://github.com/github/fetch/issues/89 https://stackoverflow.com/ques ...
随机推荐
- 支付回调地址 同步回调地址 异步回调地址 return_url和notify_url的区别
[微信支付]JSAPI支付开发者文档 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_16&index=10 退款结果通知 ...
- LOJ104 普通平衡树
题目描述 这是一道模板题. 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作: 插入 x 数: 删除 x 数(若有多个相同的数,因只删除一个): 查询 x 数的排名(若 ...
- Azure Terraform(八)利用Azure DevOps 实现Infra资源和.NET CORE Web 应用程序的持续集成、持续部署
一,引言 上一篇讲解到利用 Azure DevOps 将整个 Azure Web App,Azure Traffic Manager profile,Azure Storage Account,Azu ...
- MIT 6.S081 Lab File System
前言 打开自己的blog一看,居然三个月没更新了...回想一下前几个月,开题 + 实验室杂活貌似也没占非常多的时间,还是自己太懈怠了吧,掉线城和文明6真的是时间刹手( 不过好消息是把15445的所有l ...
- 复制虚拟机,链接网络问题:没有找到合适的设备:没有找到可用于链接System eth0 的
http://my.oschina.net/coolfire368/blog/292742 1./etc/udev/rules.d/70-persistent-net.rules 修改也成,修改时留下 ...
- PHP版本Non Thread Safe和Thread Safe如何选择?区别是什么?
PHP版本分为Non Thread Safe和Thread Safe,Non Thread Safe是指非线程安全,Thread Safe是指线程安全,区别是什么?如何选择? Non Thread S ...
- TcaplusDB 10周年 风雨兼程破浪行 自研存储见成长
从找不到需求险些被叫停,到支撑亿级DAU的数据库行业标杆,腾讯云数据库TcaplusDB在风雨中走过了整整10年.辉映日月破风浪,十年一剑破九天.百万行代码就像淙淙流淌的数据溪流,终于在十年后汇成不可 ...
- 从微信小程序到鸿蒙js开发【04】——list组件
目录: 1.可滚动区域 2.list + list-item 3.list + list-item-group + list-item 1.可滚动区域 在许多场景中,页面会有一块区域是可滚动的,比如这 ...
- jQuery插件Validate
一.导入js库 <script type="text/javascript" src="<%=path %>/validate/jquery-1.6.2 ...
- 2019牛客暑期多校训练营(第五场)C - generator 2 (BSGS)
题目链接 题意: 给定\(n,x_0,a,b,p\),有递推式\(x_i = (a \cdot x_{i-1} +b)\%p\). 有\(Q\)个询问,每次询问给定一个\(v\),问是否存在一个最小的 ...