vue怎么使用el-upload实现文件上传功能
发表于:2025-11-11 作者:千家信息网编辑
千家信息网最后更新 2025年11月11日,这篇文章主要介绍了vue怎么使用el-upload实现文件上传功能的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇vue怎么使用el-upload实现文件上传功能文章都会有
千家信息网最后更新 2025年11月11日vue怎么使用el-upload实现文件上传功能
这篇文章主要介绍了vue怎么使用el-upload实现文件上传功能的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇vue怎么使用el-upload实现文件上传功能文章都会有所收获,下面我们一起来看看吧。
upload.vue
选择文件 点击上传
springboot后台 uploadController.java
package com.example.demo.controller; import java.io.File;import java.io.FileOutputStream;import java.io.InputStream;import java.util.List; import org.springframework.web.bind.annotation.CrossOrigin;import org.springframework.web.bind.annotation.PostMapping;import org.springframework.web.bind.annotation.PutMapping;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.ResponseBody;import org.springframework.web.bind.annotation.RestController;import org.springframework.web.multipart.MultipartFile; import com.example.demo.entity.ListParam;import com.example.demo.entity.MyUser;import com.example.demo.entity.Result; @RestController@ResponseBody@CrossOrigin@RequestMapping("/api")public class UploadController { @PostMapping("/uploadUi") public Result upFile(@RequestParam("name")String name,@RequestParam("files") MultipartFile[] files ) { System.out.println("开始"); System.out.println(name); if(files != null) { for(MultipartFile file : files) { String fileName = file.getOriginalFilename(); System.out.println(fileName); try{ File mkdir = new File("F:\\app\\file"); if(!mkdir.exists()) { mkdir.mkdirs(); } //定义输出流,将文件写入硬盘 FileOutputStream os = new FileOutputStream(mkdir.getPath()+"\\"+fileName); InputStream in = file.getInputStream(); int b = 0; while((b=in.read())!=-1){ //读取文件 os.write(b); } os.flush(); //关闭流 in.close(); os.close(); }catch(Exception e) { e.printStackTrace(); return new Result(401,"失败"); } } return new Result(200,"成功"); }else { return new Result(401,"文件找不到"); } } }关于"vue怎么使用el-upload实现文件上传功能"这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对"vue怎么使用el-upload实现文件上传功能"知识都有一定的了解,大家如果还想学习更多知识,欢迎关注行业资讯频道。
文件
功能
知识
成功
内容
篇文章
价值
信息
后台
操作简单
文章
方法
易懂
更多
看吧
硬盘
行业
资讯
资讯频道
频道
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
东莞盲盒软件开发电话
沈飞网络安全教育
王珊萨师煊数据库概述
江苏环保网络技术大概费用
南通视频网络技术有限公司
居民医保大数据库
软件开发时间多久
完美世界的网络安全的工资
网络安全保卫处的职责
linux上传到服务器
数据库常量配置文件是
软件开发框架名称
网络安全协调管理
条型码查询数据库
姐数据库算存储产品吗
国税 网络安全应急演练
枫之谷m哪个服务器好
网络安全中的网络是指的啥
河北ios软件开发信息推荐
数据库与web技术
沈阳糖豆网络技术
软件开发类项目总结报告
曙光服务器管理口在哪里
道闸服务器调试
心动网络安全绘画
网络安全宣传语会标
微信如何找回丢失的数据库
代理服务器for mac
绩效考核软件开发功能需求
数据库属性用什么图形表示