• Post Reply Bookmark Topic Watch Topic
  • New Topic

Uploading Files With JSP

 
Gillian Daniel
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I hope I can articulate myself well enough for you to understand what I wish to do. I am also not sure of which forum is best to post in, as I am using many technologies, but figure that jsps are the most relevant one in this question.

I am working on a project, where we are using Struts, Weblogic 8.1 and EJBs. One of the requirements is to be able to upload a file from the client to the server, so that the contents of that file can be created in the database.

I have not been able to do this at all, as when I attempt to read from a file on a client machine, obviously the server assumes it is on the server and attempts to find that path.

I am wondering if anyone can assist me. If you require more details, I will oblige.

Looking forward to hearing from someone,
Gillian
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Search this forum (and perhaps Servlets) for file upload topics. Lots of previous discussion on this topic will be had.

Essentially it boils down to:

1) Create a JSP or HTML page with a form with a multi-part enctype, and an action referencing your upload servlet.
2) Add a 'file' element to that form that the end user will use to select the file off of the client file system.
3) When the form is submitted to your upload servlet, parse the resulting multi-part request to get the file contents (or use a 3rd party package like this to do it for you).
4) Write the obtained contents to the database.
[ November 04, 2004: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!