上传文件获取文件流 <div> 上传文件 : <input type="file" name = "file" id = "fileId" /> </div> <script> function getFile() { //js写法 var file=document.getElementById('fileId').files[0;]//获取文件流 var fileName = file.name
先写一个表单: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"
xmlrequest: sendForm(str, types) { var form = this.$refs.ipas_form; var oOutput = document.querySelector("div"), oData = new FormData((document.forms.namedItem(str))); oData.append("username", "This is some extra data"); var