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

https://javarevisited.blogspot.com/2017/06/difference-between-applicationx-www-form-urlencoded-vs-multipart-form-data.html


post upload file & application/x-www-form-urlencoded & multipart/form-data的更多相关文章

  1. 通过iframe 实现upload file无刷新

    <html>    <head> </head> <body> <form encType="multipart/form-data&q ...

  2. Express web框架 upload file

    哈哈,敢开源,还是要有两把刷子的啊 今天,看看node.js 的web框架 Express的实际应用 //demo1 upload file <html><head><t ...

  3. 页面无刷新Upload File

    页面无刷新Upload File. 利用jquery.form.js的ajaxForm提交文件. 具体参考以下代码: 前台html <%@ Page Language="C#" ...

  4. jQuery文件上传插件jQuery Upload File 有上传进度条

    jQuery文件上传插件jQuery Upload File 有上传进度条 jQuery文件上传插件jQuery Upload File,插件使用简单,支持单文件和多文件上传,支持文件拖拽上传,有进度 ...

  5. Upload file

    <h3>Upload File</h3> <form action="@Url.Action("Upload","UploadCo ...

  6. Angular HttpClient upload file with FormData

    从sof上找到一个example:https://stackoverflow.com/questions/46206643/asp-net-core-2-0-and-angular-4-3-file- ...

  7. 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 ...

  8. apache php upload file

    /********************************************************************************* * apache php uplo ...

  9. fetch API & upload file

    fetch API & upload file https://github.com/github/fetch/issues/89 https://stackoverflow.com/ques ...

随机推荐

  1. windows命令行关闭IE代理

    打开:reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnab ...

  2. LibreOJ #10047

    应同机房某大佬的要求来写这篇题解 Description 给定一个字符串 \(S\) 和一个数 \(K\),要求求出 \(S\) 的所有形似 \(A+B+A\) 的子串数量,其中 \(\mid A\m ...

  3. Cisco静态路由

    怎样让身在两个网段的终端会话交流呢?我们借用Cisco packet研究一下Cisco静态路由. 名词解释: 网关:(Gateway)网间连接器,或叫协议转换器:举例(参考https://baike. ...

  4. docker(6)镜像的使用

    前言 Docker的三大核心概念:镜像.容器.仓库.初学者对镜像和容器往往分不清楚,学过面向对象的应该知道类和实例,这跟面向对象里面的概念很相似 我们可以把镜像看作类,把容器看作类实例化后的对象. d ...

  5. 《进击吧!Blazor!》第一章 4.数据交互

    <进击吧!Blazor!>是本人与张善友老师合作的Blazor零基础入门系列视频,此系列能让一个从未接触过Blazor的程序员掌握开发Blazor应用的能力. 视频地址:https://s ...

  6. <<Hive编程指南>>读书笔记

    1. 设置hive以本地模式运行(即使当前用户是在分布式模式或伪分布式模式下执行也使用这种模式) set hive.exec.model.local.auto=true; 若想默认使用这个配置,可以将 ...

  7. 【洛谷 p3376】模板-网络最大流(图论)

    题目:给出一个网络图,以及其源点和汇点,求出其网络最大流. 解法:网络流Dinic算法. 1 #include<cstdio> 2 #include<cstdlib> 3 #i ...

  8. zjnu1730 PIRAMIDA(字符串,模拟)

    Description Sample Input 6 JANJETINA 5 1 J 1 A 6 N 6 I 5 E Sample Output 1 0 2 1 1 题意:给你一个长度小于等于10^6 ...

  9. windows创建p12格式的ios开发证书的流程

    现在做ios开发,原生的开发已经不是第一选择,现在有很多不同的H5开发框架,在性能上都不输原生开发,而UI方便却能做得比原生更炫,比如CSS得灵活度肯定是比原生开发出来得应用更灵活的. 我们在开发IO ...

  10. Nginx基础 - 常用模块配置

    1.Nginx状态监控http_stub_status_module记录Nginx客户端基本访问状态信息 location /mystatus { stub_status on; access_log ...