Convert FormFile to Java.io.File

11,365

Here, I found something you might use:

http://www.coderanch.com/t/54902/Struts/Struts-FormFile-java-io-File

Share:
11,365
Alessandro Vasi
Author by

Alessandro Vasi

Updated on June 04, 2022

Comments

  • Alessandro Vasi
    Alessandro Vasi almost 2 years

    I have an object FormFile recovered through a Struts Form . I have to convert Java side in the java.io.File How can I do? The casting in this way by exception:

    File myFile = (File) fileFormFile
    
    • sp00m
      sp00m about 11 years
      You're probably not the first one who's looking for that job. Have you search online before asking?
    • SJuan76
      SJuan76 about 11 years
      A java.IO.File is little more than the path to a file and some utility methods. If you want to save an object to disk, you will need FileOutputStream and similar classes.