• Post Reply Bookmark Topic Watch Topic
  • New Topic

regarding file creation on server -very urgent  RSS feed

srinivas srini
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
Im using apache tomcat 4.1 server how can i create a folder at server and copy the file in that folder if the client uploads the file. i have tested my code on my own system where client and server are on the same machine the code is

String path= "c:\program files\apache tomcat 4.1\webapps\jetspeed\technologies";
//im creating the folders by the following code here directory=ejb\20 or jsp\21 or any combinations
//(i:e technology\number)

if((new File(path+"\\"+directory).exists()))
System.out.println("Directory already exists ");
System.out.println("does not exists ");
new File(path+"\\"+directory).mkdir();
path = path + directory + somefile.txt
File outputFile = new File(path);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1)
this code is properly working in my system (client and server both are on the same machine) but when the client is on the different machine this code may not work, so what should i do so that i get the same functionality what i got when the server and the client are on the same system.
please put a code which could be usefule to me
thanks in advance
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!