File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Upload

 
Arulanand Dayalan
Ranch Hand
Posts: 126
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a form in which user can attach files and fill the details in the form and submit. He can attach any number of files and can delete the attached files. Once he attaches files, it will be displayed and he will fill the rest of the form and submits. The problem is i dont know how to handle this scenario. I came up with two ideas.
1. On attaching the file store it temp. in a table in database. Once the user fills the rest of the form and submit save it to the main table. The problem in this apporach if he going to cancel the form then i wnt to delete the attached files, it can be done if he clicks on the cancel button. But he closes browser clicks on some other thing in the menu i could not handle.
2. Display only the file name and on submit based on the path get the data, but in this case how to handle this because on submission of the form only the path goes to the server and u cant retreive it.

Anybody could suggest a better idea for solving this i could be great help for me.
 
Kerry Wilson
Ranch Hand
Posts: 254
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as the user canceling. Assign each user a unique id into session, use this to track 'temporary' files. Create session listener that deletes all temporary files of the unique id when session is destroyed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic