GeeCON Prague 2014*
The moose likes I/O and Streams and the fly likes regarding file creation on server -very urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "regarding file creation on server -very urgent" Watch "regarding file creation on server -very urgent" New topic
Author

regarding file creation on server -very urgent

srinivas srini
Greenhorn

Joined: Feb 03, 2004
Posts: 23
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 ");
}
else
{
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)
out.write(c);
in.close();
out.close();
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
 
GeeCON Prague 2014
 
subject: regarding file creation on server -very urgent