Click here to Skip to main content
13,196,730 members (78,368 online)
Rate this:
Please Sign up or sign in to vote.
I have a file upload solution in Struts2/spring integrated app.
I have a validation for the files the user selects. if the user selected 3 files and 1 of them fails validation, i return the user back to the same upload page.

My problem is, for the other two files that went through the file validation I cannot keep the content(file path) on postback (when i return to the upload page with error)due to security reasons for browsers.

Right now I am storing them in the session. But jvm might crash with this.
Is there a better way to implement this ??
Posted 8-Dec-12 16:47pm
Gian rebollido 26-Mar-13 1:37am
i don't think so.. post your code first..

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


You should do such task in background as a asynchronous batch job. One simple way is to use Quartz Scheduler and use to validate the file contents. This way user does not have to wait for the validation to complete. The scheduled job will typically use the database to keep track of progress. You can build a view over this table so that users can find out what happened to their uploads.
However if you must do this in a synchronous manner, then there is no need to keep the file contents of successfully validated files anywhere. Just keep the names in a session variable. On postback use values from session to skip validations of already checked files. For safety reasons you may also want to compute the checksums and store them as well. This way if new and old checksums do not match then you can re-validate the files. Once the validation is successful you can remove this variable from session.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171019.1 | Last Updated 24 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100