Posted: Wed Jun 13, 2007 9:17 am JSP create directory and upload file question
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();
%>
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