js上传文件
//jquery
var formdata = new FormData();
formdata.append("file", e.target.files[0]);
$.ajax({
type: 'post',
dataType: 'json',
url: 'url'
data: formdata,
contentType: false,
processData: false
}).success((data) => {
}).error((data, timeout, err) => {
})
//axios
let formData=new FormData();
formData.append('attachment',file);
let config = {
headers: {
'Content-Type': 'multipart/form-data;charset=UTF-8'
}
};
axios.post(url,formData,config).then(({data})=>{
});