I need to send a file into a servlet through a web page. I would like to prompt the user with a file prompt. When the user browses to the file they need and hit OK, the file and path would be returned. Anyone have some idea how I might do this? Are there any APIs out there to do this?
By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Oh, and on the browser side, put something like this on a form:
[ January 11, 2006: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
The browser side is what I'm mostly concerned with. Getting the file into the servlet is the least of my concerns. I'm mostly concerned w/the user having the ability to browse to the file and have the path and file name picked up by the file requester. Any solution for this?
By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Oh, and by the way if you were thinking that your servlet just gets the path and file name, that isn't the way it works. The browser uploads the file name (and sometimes the path, but the servlet doesn't need it) and the contents of the file. The client side is actually the least of your concerns, processing file uploads is difficult. Unless you use the Commons FileUpload package that Stan linked to, in which case it's almost trivial.