如何用ASP.NET实现JS表单的GET和POST长尾词数据提交?
- 内容介绍
- 文章标签
- 相关推荐
本文共计638个文字,预计阅读时间需要3分钟。
最近工作中使用了一种使用JS+form以post方式上传文件的方式。前台页面使用Html+input,通过JS向服务器上传文件。具体实现代码如下:
前台页面(aspx网页):
JavaScript代码:javascriptdocument.getElementById('fileInput').addEventListener('change', function() { var formData=new FormData(); formData.append('file', this.files[0]);
fetch('server/upload', { method: 'POST', body: formData }) .then(response=> response.json()) .then(data=> console.log(data)) .catch(error=> console.error('Error:', error));});
最近工作中用到了一种使用JS+form用post方式上传文件一种方式。
本文共计638个文字,预计阅读时间需要3分钟。
最近工作中使用了一种使用JS+form以post方式上传文件的方式。前台页面使用Html+input,通过JS向服务器上传文件。具体实现代码如下:
前台页面(aspx网页):
JavaScript代码:javascriptdocument.getElementById('fileInput').addEventListener('change', function() { var formData=new FormData(); formData.append('file', this.files[0]);
fetch('server/upload', { method: 'POST', body: formData }) .then(response=> response.json()) .then(data=> console.log(data)) .catch(error=> console.error('Error:', error));});
最近工作中用到了一种使用JS+form用post方式上传文件一种方式。

