Storing the FormFile reference into the request wont help; request
attributes are discarded at the end of request processing, so by the
time the next page submits the first request has gone away. To keep
something from one request available to the next request, you would have
to put it into the session.
However, storing a FormFile reference in the session probably wont help
either. A FormFile is just a chunk of meta data that allows the physical
file to be found on disk. If the physical file is deleted, having a
reference to where it used to be isn't very useful...
You will either need to read the whole file in the first request and
cache the data somewhere (e.g. in the session), or make a copy the file
to load in the second request. You need to make a copy (of the file, or
the data in it) as Struts will automatically delete the original file at
the end of the request in which it was received.
L.
Tom Holmes Jr. wrote:
Ok ..... maybe what I'll do in this case is put the FormFile into the
request manually, so I can pass it from one page to the next.
I'm not so much concerned with the FormFile.getInputStream since I can
use FormFile.getFileData to get the byte array data.
Thanks!
Antonio Petrelli wrote:
2008/3/27, Tom Holmes Jr. <[EMAIL PROTECTED]>:
Anyway, my question is after I upload my file and look at the data, I
want to hold onto that file to the next page.
...
Can I do this, or do I need to parse the entire file after the first
page, and then how would I persist this without writing it to a
database.
You need to parse the input stream as it comes. The reason why the
FormFile
does not return an input stream at the following request is that the
input
stream is connected to the previous HTTP request.
How you can persist it is a problem of yours, Struts cannot help in this.
But anyway, I suggest to parse that file and "remember" only the portions
you really need.
Antonio
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG. Version: 7.5.519 / Virus Database: 269.22.1/1346 -
Release Date: 3/27/2008 10:03 AM
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]