File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Saving file at server

 
Manu Syal
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to save a string as a file at server end . I am using JWS and when I save it using FileWriter it get saved at the JWS root directory. I need to save the file in a paticular directory at web server ie. like http://localhost:/pubic_html/abc .
I am reading the file through this
URL myURL = new URL("http://localhost:8080/template/template.htm");
BufferedReader in= new BufferedReader(new InputStreamReader(myURL.openStream()));
and I am saving like this
FileWriter f1=new FileWriter("reslt.htm");
f1.write(str,0,str.length());
f1.close();
It get saved at JWS root directory .When I tried giving the full server path with the file name in FileWriter it did not worked
I need to save the file at particular directory ie. virtual directory at the server
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to try this
File f1=new File("your path\reslt.htm")
FileWriter f2=new FileWriter(f1.getPath());
Bosun
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic