<input id="fileupload" type="file" class="form-control" name="file" >
$("#fileupload").on("change",function(){
var file = this.files[0];
var data = new FormData();
data.append("file", file);
console.log(data);
console.log(file);
$.ajax({
type: "post",
url: " ",
data: data,
contentType: false,
//默认文件类型application/x-www-form-urlencoded 设置之后multipart/form-data
processData: false,
// 默认情况下会对发送的数据转化为对象 不需要转化的信息
success: function (res) {
source = res.picAddr;
},
});
})
jq / vue 图片直传阿里云
avoidaily2024-03-02 22:29
相关推荐
Mh7 小时前
别再只会 `find` 了:Map 在前端业务里的真实用法陈随易8 小时前
FFmpeg 9.0 发布,代号 Lei,音视频处理再升级爱丶狸8 小时前
Grafana_Zabbix_ImageRenderer_部署与前端操作手册用户0595401744611 小时前
把AI对话记忆存储测试从手工改成Playwright+pytest,覆盖率从20%提到96%,回归时间缩短90%kyriewen11 小时前
别再这样写TypeScript了——Code Review中最常见的8个反模式名字还没想好☜11 小时前
Next.js ‘use client‘ 到底加在哪:Server/Client Components 边界与常见报错午安~婉12 小时前
GitHub Token/ GitHub Stats统计显示图异常码云之上12 小时前
AI Agent 工程化总览篇:从 Prompt 到 Harness2501_9269783312 小时前
以说明书 DNA 为模板——完整 AGI 的结构图景IT_陈寒12 小时前
Vite静态资源引用这个坑我踩得有点疼




