You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anshul Khare <an...@tavant.com> on 2007/05/14 06:40:00 UTC

Struts 2
Hi everyone,

I am using Struts 2 and using <s:file> tag to upload a file.
But I get that file as a 'File' object in my action class and using
getName() on that File object returns me some arbitrary value (something
like upload__5b41f107_1127b4befe0__8000_00000000.tmp). I want to
retrieve things like ContentType, File Name etc which was possible in
struts 1.1 using methods like getContentType(), getFileName() on
FormFile Object.
 
How do I accomplish the same in Struts 2 ?
 
Please Help !!
 
Thanks
Anshul
Any comments or statements made in this email are not necessarily those of Tavant Technologies. The information transmitted is intended only for the 
person or entity to which it is addressed and may contain confidential and/or privileged material. If you have received this in error, please contact 
the sender and delete the material from any computer. All e-mails sent from or to Tavant Technologies. may be subject to our monitoring procedures.

Re: Struts 2 Posted by Dave Newton <ne...@yahoo.com>.
--- Anshul Khare <an...@tavant.com> wrote:
> I want to retrieve things like ContentType, File
Name
> etc which was possible in struts 1.1 using methods 
> like getContentType(), getFileName() on FormFile 
> Object.
>  
> How do I accomplish the same in Struts 2 ?

http://struts.apache.org/2.x/docs/file-upload-interceptor.html
http://struts.apache.org/2.x/docs/how-do-we-upload-files.html

Also note that at least so far it seems necessary (?)
to us the ActionContextCleanUp filter to get file
uploads to work, but this may no longer be the case (I
don't know one way or the other).

http://struts.apache.org/2.x/struts2-core/apidocs/index.html

d.



      ____________________________________________________________________________________
Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.
http://autos.yahoo.com/green_center/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org