aspose file tools*
The moose likes JSP and the fly likes Fileupload with JSP/Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Fileupload with JSP/Servlet" Watch "Fileupload with JSP/Servlet" New topic
Author

Fileupload with JSP/Servlet

Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
Hi,

I want to upload a file to my database as blob. i have a servlet doing this, but how can i pass the file(path) from my <form> in my jsp to the servlet? Sorry a simple question...

thx a lot
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Take a look at http://jakarta.apache.org/commons/fileupload.
It's a well used upload library and comes with documentation and examples.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
thx i also find something:


<FORM ENCTYPE='multipart/form-data'
method='POST' action='/myservlet'>
<INPUT TYPE='file' NAME='mptest'>
<INPUT TYPE='submit' VALUE='upload'>
</FORM>

@

http://www.jguru.com/faq/view.jsp?EID=160
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Kay Tracid:
thx i also find something:


<FORM ENCTYPE='multipart/form-data'
method='POST' action='/myservlet'>
<INPUT TYPE='file' NAME='mptest'>
<INPUT TYPE='submit' VALUE='upload'>
</FORM>

@

http://www.jguru.com/faq/view.jsp?EID=160


Yes, that is what your HTML forms will need to look like.
You will also need some libraries to handle the multipart data on the server. The link I gave you will provide just such a set of libraries.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Fileupload with JSP/Servlet