将文件存储在apache tomcat服务器的ROOT目录中

发布于 2024-12-28 16:17:05 字数 225 浏览 0 评论 0原文

我想通过java代码将文件存储在Apache Tomcat服务器的ROOT目录中,那么如何做到这一点,因为目前我得到的上下文路径类似于c:\\.....\selfprov 所以我正在做 contextPath + File.seperator + "ROOT" 但它不会将文件存储在“ROOT”目录中,我认为我需要一些权限才能将文件存储在 ROOT 目录中,但我做到了但仍然没有存储。

I want to store file in the ROOT Directory of Apache Tomcat server through java code so How to do this, because currently I am getting a context path which comes like c:\\.....\selfprov so I ma doing contextPath + File.seperator + "ROOT" but it doesn't store the file inside "ROOT" directory i think i need some permission to store the fiule inside ROOT directory but i did that but still its not storing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时常饿 2025-01-04 16:17:05

阅读此示例 阅读此示例 http://www.tutorialspoint.com/servlets/servlets -file-uploading.htm 它有

DiskFileItemFactory factory = new DiskFileItemFactory();
  // maximum size that will be stored in memory
  factory.setSizeThreshold(maxMemSize);
  // Location to save data that is larger than maxMemSize.
  factory.setRepository(new File("c:\\temp"));

Read this sample read this example http://www.tutorialspoint.com/servlets/servlets-file-uploading.htm it has

DiskFileItemFactory factory = new DiskFileItemFactory();
  // maximum size that will be stored in memory
  factory.setSizeThreshold(maxMemSize);
  // Location to save data that is larger than maxMemSize.
  factory.setRepository(new File("c:\\temp"));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文