aspose file tools*
The moose likes Struts and the fly likes How to Convert a java.io.File to struts FormFile? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to Convert a java.io.File to struts FormFile? " Watch "How to Convert a java.io.File to struts FormFile? " New topic
Author

How to Convert a java.io.File to struts FormFile?

Deepak Kumar
Ranch Hand

Joined: Nov 05, 2007
Posts: 62
Hi All,

I have a method XYZ(org.apache.struts.upload.FormFile file) and a method ABC(java.io.File f).
I want to convert file of type java.io.File into struts FormFile, so that I can invoke the method XYZ(FormFile file) within the method ABC(java.io.File f).

Please help me.

Thanks & Regards,
Deepak


Thanks,
Deepak
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Originally posted by Deepak Kumar:
Hi All,


I want to convert file of type java.io.File into struts FormFile, so that I can invoke the method XYZ(FormFile file) within the method ABC(java.io.File f).



You cant convert the io.File object to that of type Struts FormFile, because they altogether two different things, there is no relation between them ,,

Can you modify your existing method parameters , like you can take another parameter of Struts FormFile in ABC method, as



[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Deepak Kumar
Ranch Hand

Joined: Nov 05, 2007
Posts: 62
Thanks very much Sagar Rohankar.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Hey , has that really help you ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Convert a java.io.File to struts FormFile?