扫码关注官方订阅号
这是提供的API 接口地址 experiencereport/imgupload.do 接受入参数 imgfile 后台接受的整个文件
前端js 把怎么文件传过去??
人生最曼妙的风景,竟是内心的淡定与从容!
用POST提交,或者放在一个form表单里面提交。
<input type="file" name="f1"/>
如果是用 Ajax 的話
Ajax
<input type="file" name="imgfile">
var file = $('input[name="imgfile"]').prop('files')[0] var formData = new FormData(); formData.append('imgfile', file) $.ajax({ url: 'experiencereport/imgupload.do', type: 'POST', data: formData, // 省略 });
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
用POST提交,或者放在一个form表单里面提交。
<input type="file" name="f1"/>
如果是用
Ajax的話