Multipart transferTo looks for a wrong file address when using createTempFile

后端 未结 3 915
灰色年华
灰色年华 2021-01-22 01:04

I have the following java code in Spring framework to convert a multipart file to a regular file:

    public static File convertToFile(MultipartFile multipart) {         


        
3条回答
  •  礼貌的吻别
    2021-01-22 01:17

    I figured out what I was doing wrong.

    I was trying to convert MultipartFile to File outside of the service layer (in another component). Now I do this conversion inside the service layer (but in a separate class) and it's working fine.

提交回复
热议问题