文件上传结合springboot

目录

前台页面

后台接口

文件上传总结

前端页面三要素

服务端接收文件


前台页面

<form action="/upload" method="post" enctype="mutipart/form-data">

姓名<imput type="text" name="username"><br>

年龄<imput type="text" name="age"><br>

头像<imput type="file" name="image"><br>

<imput type="submit" value="提交">

</form>

后台接口

@PostMapping("/upload")

public Result upload(String username,Integer age,MultipartFile image) {

//逻辑处理

return Result.success();

}

文件上传总结

前端页面三要素

表单项type="file"

表单提交方式post

表单的enctype属性mutipart/form-data

服务端接收文件

MultipartFile

相关推荐
摇滚侠1 天前
帮我整理一份 IDEA 开发中常用快捷键
java·ide·intellij-idea
疯狂成瘾者1 天前
YAML配置介绍
java
cccccc语言我来了1 天前
C++轻量级消息队列服务器
java·服务器·c++
better_liang1 天前
每日Java面试场景题知识点之-MCP协议在Java开发中的应用实践
java·spring boot·ai·mcp·企业级开发
河阿里1 天前
SpringBoot :使用 @Configuration 集中管理 Bean
java·spring boot·spring
xiaoshuaishuai81 天前
C# Codex 脚本编写
java·服务器·数据库·c#
Flittly1 天前
【SpringSecurity新手村系列】(4)验证码功能实现
java·spring boot·安全·spring
Flittly1 天前
【SpringSecurity新手村系列】(3)自定义登录页与表单认证
java·笔记·安全·spring·springboot
小小码农Come on1 天前
C++访问QML控件-----QML访问C++对象属性和方法
java·开发语言·c++
Stella Blog1 天前
狂神Java基础学习笔记Day04
java·笔记·学习