Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

uploading a file

 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any idea how do we allow users to upload their files using JSP..
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jyotsana -
just go to the search link and you will find tons of information related to it. This topic is very popular here.
regards
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In brief, I would say, checkout JSPSmart Upload & com.oreilly components.
hth
MB
 
Ajith Pande
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Uploading file into hard drive is very simple
here some sample code
---------------in jsp--------------
<input type=file name=...>
----------------------------------
---in java-----------
import com.oreilly.servlet.MultipartRequest,
java.io.File file = multipartRequest.getFile("file");
file.renameTo(new java.io.File("c:\newfile"));
//here u need not to create that file, it wll create itself .it jsut like coping file
//and one more thing pls put cos.jar file into lib dir and add it to classpath
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic