File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Uploading files at server Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Uploading files at server" Watch "Uploading files at server" New topic
Author

Uploading files at server

Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 451
I have to develop a website where user can upload their html page. This webpage i have to save on server. For every user i have to create a folder with the name of his userid. Now my problem is, to create a folder i must know the absolute path of my jsp page(which is not possible). How can i create a folder in the folder in which my jsp page exist.

thanx


Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
RAJESH RASTOGI
Greenhorn

Joined: Jan 20, 2002
Posts: 17
u can get the real path on the server of the jsp file by using
application.getRealPath("jspfilename.jsp");
now u have the path of ur jsp file, now u can create the folder n upload the html files.
Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 451
Thanks rajesh, this is exactly what i was looking for
 
 
subject: Uploading files at server
 
Threads others viewed
absolute URL path problem in jsp:forward ... tag
how to select a folder.???? to select a file input type "file" what for folder
Java class in JSP doubt
session variable lost
user create folder at local
IntelliJ Java IDE