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 ...
随机推荐
- 小步前进之WebService
WebService Web Service 什么是Web Service? 为什么使用Web Service XML 什么是XML? 为什么使用XML? SOAP(Simple Object Acc ...
- 理解前端模块概念:CommonJs与ES6Module
前言 现代前端开发每时每刻都和模块打交道.例如,在项目中引入一个插件,或者实现一个供全局使用组件的JS文件.这些都可以称为模块. 在设计程序结构时,不可能把所有代码都放在一起.更为友好的组织方式时按照 ...
- SQLyog破解30天到期
开始--运行中输入regedit.找到regedit.exe 文件 点击regedit.exe...就把注册表编辑器打开了 我们需要找到记录软件使用实现的数据...找到HKEY-CURRENT ...
- Python学习【第5篇】:数据类型和变量总结
字符串,数字,列表,元组,字典 可变不可变 1.可变:列表 如: p.p1 { margin: 0; font: 11px Menlo; color: rgba(0, 0, 0, 1); backgr ...
- Vue技术点整理-指令
我们通常给一个元素添加 v-if / v-show 来做权限管理,但如果判断条件繁琐且多个地方需要判断,这种方式的代码不仅不优雅而且冗余. 针对这种情况,我们可以通过全局自定义指令来处理:我们先在新建 ...
- SparkStreaming直连方式读取kafka数据,使用MySQL保存偏移量
SparkStreaming直连方式读取kafka数据,使用MySQL保存偏移量 1. ScalikeJDBC 2.配置文件 3.导入依赖的jar包 4.源码测试 通过MySQL保存kafka的偏移量 ...
- Spring Boot自定义starter必知必会条件
前言 在目前的Spring Boot框架中,不管是Spring Boot官方还是非官方,都提供了非常多的starter系列组件,助力开发者在企业应用中的开发,提升研发人员的工作效率,Spring Bo ...
- 加快你ROS安装的一篇文章
前言: 首先ROS大家应该比较熟悉了哈,如果需要补充一下请看我之前的这篇文章 <嵌入式的我们为什么要学ROS>,对于嵌入式来说ROS是一个很好的进阶方向,所以如何快速的安装一个ROS到我们 ...
- Kwp2000协议的应用(程序后续篇)
作者:良知犹存 转载授权以及围观:欢迎添加微信:becom_me 总述 接上篇文章,本篇继续对基于PID解析数据,如何依据J1979的标准进行解析数据 先给昨天的文章补上一张故障码对照表,昨天分析了如 ...
- HDOJ 1242
纠结1242很久了,查了题解才发现要优先队列才能成功 http://blog.chinaunix.net/uid-21712186-id-1818266.html 使人开窍之文章 优先队列,已经不算是 ...