`
kanpiaoxue
  • 浏览: 1781125 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

SpringBoot项目的The temporary upload location ***is not valid 问题

 
阅读更多

在linux上面使用springboot的上传文件的功能的时候,引起下面的异常:

写道
org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.6561926259726375802.9096/work/Tomcat/localhost/ROOT] is not valid

原因是:springboot启动之后会在 /tmp 目录创建文件夹等内容,上传文件夹在那里是不存在的 。

解决方案:在配置文件中添加上传文件的临时目录:

spring:
  servlet:
    multipart:
      enabled: true
      location: /hello/tempuploadfiles

 

 或者在启动参数上面添加JVM的参数指定临时文件夹:

-Djava.io.tmpdir=temp

 

 

 

参考资料:

1、https://stackoverflow.com/questions/29923682/how-does-one-specify-a-temp-directory-for-file-uploads-in-spring-boot

2、https://blog.csdn.net/llibin1024530411/article/details/79474953

分享到:
评论

相关推荐

    SpringBoot导入上传文件异常The temporary upload location is not valid

    错误spring boot上传文件错误The temporary upload location [/tmp/tomcat.******/work/Tomcat/localhost/ROOT] is not valid

    servlet3.0文件上传 01.zip

    1、在上传文件前请在计算机C盘新建一个名为“upload”的文件夹,否则会出现如下异常:java.io.IOException: The temporary upload location [C:\upload] is not valid 2、请不要使用360安全浏览器演示本功能,否则会...

    servlet3.0实现文件上传——demo1.zip

    1、在上传文件前请在计算机C盘新建一个名为“upload”的文件夹,否则会出现如下异常:java.io.IOException: The temporary upload location [C:\upload] is not valid 2、请不要使用360安全浏览器演示本功能,否则会...

    SpringBoot 整合Mybatis 创建临时表

    @Insert("CREATE TEMPORARY TABLE IF NOT EXISTS temp_table (id INT PRIMARY KEY, name VARCHAR(255))") void createTempTable(); @Select("SELECT * FROM temp_table") List<TempTable> selectFromTempTable...

    IBM MQ错误码大全

    2046: Options not valid or not consistent.** - **含义**:选项无效或不一致。 - **解决方案**:检查选项的有效性和一致性。 **45. 2047: Persistence not valid.** - **含义**:持久性设置无效。 - **解决方案*...

    Unix Commands (Aix Freebsd Hpux Linux Solaris & Tru64)

    The primary focus is on understanding the differences and similarities in how these systems manage file systems, user accounts, and configurations. #### Directory Mappings Each Unix variant handles...

    Java_for_the_Web_with_Servlets

    - **How a Servlet Works**: When a request is sent to a servlet, the servlet container creates a new instance of the servlet if one does not already exist. The `init()` method initializes the servlet, ...

    联想旭日420AXP系统芯片组驱动

    If the -A option is exercised, the files are not copied to the <Windows>\INF directory. Refer to Section 4 for more information. ************************************************************ * 4...

    AT指令返回错误大全

    - **CMEERROR:113 - Roaming not allowed in this location area**:在此位置区域不允许漫游。 - **CMEERROR:126 - Operation temporary not allowed**:操作暂时不允许。 - **CMEERROR:132 - Service operation not...

    memory leakge & initialization & invalid pointer

    - **Problem**: When using temporary variables, it is easy to overlook the need to free their memory. - **Solution**: Manage temporary variables carefully. Ensure that their scope is limited and that ...

    Effective C#

    - **Purpose:** Ensuring that the default state of a value type is valid can prevent errors. - **Example:** Define a `PersonId` struct that uses 0 as the default value. **Item 20: Prefer Immutable ...

    2009 达内Unix学习笔记

    集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...

    12c 新特性-Temporary Undo

    ### 12c 新特性:Temporary Undo #### 一、Temporary Undo 概念与优势 在Oracle 12c版本中引入了一项重要的新特性——Temporary Undo,这项技术旨在优化临时表的操作性能,并减少对Redo日志的空间占用。传统的临时...

    图解项目管理,PMP项目管理培训图解

    - **临时性 (Temporary)**:每个项目都有明确的开始和结束时间,这意味着项目团队是一次性的组织结构。 - **独特性 (Uniqueness)**:每个项目都是独一无二的,其产品或服务都具有一定的创新性和特殊性。 - **渐进...

    Construction Craftsman(Masonry).pdf

    - This indicates that the document is focused on professionals involved in the masonry trade, which involves the use of bricks, stones, and other similar materials for building structures. ...

    英语 5000个必备基本单词及其解释

    - **例句:**The act of cruelty towards animals is an abomination. 25. **Aboriginal adj. Primitive; unsophisticated.** - **词目:Aboriginal** - **释义:**原始的;未开化的。 - **例句:**The ...

    lingo 错误列表

    15. **NOT ENOUGH TEMPORARY OPERATOR STACK SPACE**:临时操作符栈空间不足。可能是因为模型过于复杂,需要简化或优化。 16. **NO RELATIONAL OPERATOR FOUND**:未找到关系运算符。在约束或目标函数中,确保使用...

    三层信令事件说明.doc

    20. **Temporary failure**:暂时性的问题,如临时的网络拥堵或设备故障。 21. **Switching equipment congestion**:交换设备负荷过重,无法处理更多呼叫。 22. **Access information discarded**:接入信息丢失或...

    oracle 错误一览表

    #### ORA-00033: Current undo tablespace is not valid - **描述**:当前撤销表空间无效。 - **解决方法**:检查撤销表空间的状态,并采取措施恢复其有效性。 #### ORA-00034: Unable to open current PL/SQL undo...

    微软内部资料-SQL性能优化5

    The only source of any storage location information is the sysindexes table, which keeps track of the address of the root page for every index, and the first IAM page for the index or table....

Global site tag (gtag.js) - Google Analytics