HTML Tutorial


 /help/HTML Help Forum   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
JSP create directory and upload file question
Post new topic   Reply to topic    HTML Help Forum -> Others
View previous topic :: View next topic  
Author Message
sonny105



Joined: 04 Jun 2007
Posts: 8

PostPosted: Wed Jun 13, 2007 9:17 am     JSP create directory and upload file question Reply with quote

Hi, The following JSP code snippet uploads a file to an existing directory called MYFILES and works fine. I would like to modify the code to create a sub-directory and then place the file in it (e.g. /FILES/FILES2/). can this be easily done? Can someone help? Thanks.

//upload a file to an 'existing' dir

<%
String dir = application.getRealPath("/files");
String fileName = "mrjones.txt";

// place the file in the directory "MYFILES"
File resultFile = new File("/MYFILES/", fileName);
resultFile.createNewFile();
%>
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum -> Others All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
DARFUR
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial