You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by MavenMan <li...@163.com> on 2007/10/23 07:47:13 UTC

how rename the upload file in struts1 ?

I want to rename upload file in my action .I code :

  FormFile file=form.getUserphoto();
  file.setFileName(String.valueOf(date.getTime()));
but error is :javax.servlet.ServletException: The setFileName() method is
not supported.

what can I do ?
thanks in advance !
-- 
View this message in context: http://www.nabble.com/how-rename-the-upload-file-in-struts1---tf4675357.html#a13357849
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: how rename the upload file in struts1 ?

Posted by MavenMan <li...@163.com>.
at first thank you .

   Yow kown that the FormFile has a method named setFileName() , but how and
when to use it ?

and any else approach to rename the uploadfile in the code ?



Laurie Harper wrote:
> 
> MavenMan wrote:
>> I want to rename upload file in my action .I code :
>> 
>>   FormFile file=form.getUserphoto();
>>   file.setFileName(String.valueOf(date.getTime()));
>> but error is :javax.servlet.ServletException: The setFileName() method is
>> not supported.
>> 
>> what can I do ?
>> thanks in advance !
> 
> The file in the form is a temporary file, so if you need it to remain on 
> disk beyond the lifetime of the request you'll need to manually copy its 
> content into a new file in an appropriate place.
> 
> L.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-rename-the-upload-file-in-struts1---tf4675357.html#a13358179
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: how rename the upload file in struts1 ?

Posted by Laurie Harper <la...@holoweb.net>.
MavenMan wrote:
> I want to rename upload file in my action .I code :
> 
>   FormFile file=form.getUserphoto();
>   file.setFileName(String.valueOf(date.getTime()));
> but error is :javax.servlet.ServletException: The setFileName() method is
> not supported.
> 
> what can I do ?
> thanks in advance !

The file in the form is a temporary file, so if you need it to remain on 
disk beyond the lifetime of the request you'll need to manually copy its 
content into a new file in an appropriate place.

L.


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