You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Hoying, Ken" <Ke...@PremierInc.com> on 2007/06/04 22:09:59 UTC
[S2] File Upload Question
As I am reading up and looking into the file upload support in S2, it
appears that files are uploaded to a temporary area and then deleted
when control is returned from the action. It would seem then that if I
wanted to keep the file, that I then need to copy it again to somewhere
else. Is this understanding correct? This seems a bit inefficient to
me, especially for larger files.
Thanks in advance.
-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] File Upload Question
Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Ken,
Yes, the interface to your action is a File. The default implementation
uses the ServletFileUpload servlet from apache-commons-fileupload which
does create a temporary file.
You can switch to other implementations or configurations by changing
some struts2 properties but the fileupload interceptor interface is
still a File, not an InputStream.
Personally I'd prefer the temporary file over an in-memory buffer, and
prefer a temporary file in a safe part of the filesystem rather than
allowing the file to be written elsewhere by the servlet.
However, it seems you have a lot of control over the implementation if
this is a problem:
http://jakarta.apache.org/commons/fileupload/using.html
Hoying, Ken wrote:
> As I am reading up and looking into the file upload support in S2, it
> appears that files are uploaded to a temporary area and then deleted
> when control is returned from the action. It would seem then that if I
> wanted to keep the file, that I then need to copy it again to somewhere
> else. Is this understanding correct? This seems a bit inefficient to
> me, especially for larger files.
>
> Thanks in advance.
>
> -------
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org