使用Spring MVC将文件上传到服务器 [英] Uploading files on to server using spring mvc

查看:150
本文介绍了使用Spring MVC将文件上传到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Spring MVC将文件列表上传到服务器.但是我可以存储到C驱动器上,但是我不知道如何上传到server.Please帮助我.

I am trying to upload list of files to the server using spring MVC. But i am able to store on to the c drive,but i don't know how to upload onto server.Please help me.

推荐答案

在Tomcat 9(服务器)目录中创建文件夹,如下所示

create a folder inside the Tomcat 9 (server) directory as follows

.../Apache Software Foundation/Tomcat 9/FileUpload

.../Apache Software Foundation/Tomcat 9/FileUpload

然后,您可以在Java中访问以上目录(FileUpload)

then, you can access the above directory (FileUpload) in java

File fileUpload = new File(System.getProperty("catalina.base"), "FileUpload");

但是,如果使用eclipse ide,则在开发期间无法访问上述目录,因此应在以下目录中为eclipse创建一个同名文件夹(FileUpload)

but, if you use the eclipse ide, in the development time you cannot access the above directory and you should be created a folder as same name (FileUpload) in the following directory for eclipse

.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/FileUpload

.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/FileUpload

您可以使用以上目录进行开发和测试

you can use above directory for development and testing purpose

这篇关于使用Spring MVC将文件上传到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆