Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes Runtime Folder Creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Runtime Folder Creation" Watch "Runtime Folder Creation" New topic
Author

Runtime Folder Creation

Sanjay pts
Ranch Hand

Joined: Nov 07, 2000
Posts: 357
Hi
All
In my applications i used file upload facility.Im able to upload file.But i want to save that file into web=-server.Now my problmes is for each user i want to creat runtime folder .I mean when user register himself that time a folder is also created with his/her user name .So when i upload servlet i can store that file into that folder.
Thanking in Advance
sanjay


Eat JAVA, Drink JAVA, Sleep Java
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15662
    
  15

1. Create a java.io.File object initialized to the path name for the directory (including the directory name itself). That is:
java.io.File myDir = new java.io.File("C:/webserver/users/fred");
(If you prefer the backslashes, don't forget to escape them!)
2. Do the following:
myDir.mkdir();
3. Wrap suitable exception handling around the above to catch cases where the directory couldn't be created, such as a full disk or wrong access rights.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
 
subject: Runtime Folder Creation
 
Similar Threads
Creating new directory in the server
to know the contents uploaded by the upload component
Creating new directory in the server
JSP uploader
Tomcat4.1.24 not working as a NT service??