i have a struts form with FormFile, it works fine with no issues.
My requirement is when a user selects a file, and click next he is taken to the review stage.
i was wondering can i display the formFile object from Strust action form which is in session
in the review stage.
Once the user reviews he clicks save and then i upload the file nad copy it on to my server.
please let me kwwo
Joined: May 12, 2008
hello all i hope i made sense
Can anyone please reply if you have any clue.
Basically i dont want to save the Form File to a temp location and show it, since i a users exists in review stage, i have to clean the directory
I'm not very good at struts 1, but if your FormFile object is in the session, then you can create an action which will call the getInputStream method on the FormFile object and send that stream to the client. The HTML will use the src attribute to point to that action on the <img tag i.e. something like [tt]<img src="getImage.do" /> . The file must be stored temporarily on the server by Struts, so you can generate a direct link to the file too, but I'm not sure how Struts 1 is configured as to where to save the file...
That what i am doing right now, when the user selects a file and goes to review state, i store the file in temp location on my server. once the user clicks save, then i move the file from temp location to actual location and deletes teh temp location.
i thought it might be easier if there is a workaround to display the using using the fileForm property in struts, since many times what happens is that a user comes until review stage and then leaves, in this case teh temp folder has the files left there which are obsolete, ofcourse i can go and manually delete teh file.
Any cleaner way to workaround this issue
subject: display Formfile from struts form in session scope