aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes writing a file onto a client from a web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "writing a file onto a client from a web application" Watch "writing a file onto a client from a web application" New topic
Author

writing a file onto a client from a web application

Chetan Bengaluru
Greenhorn

Joined: Feb 15, 2005
Posts: 9
I would like to know how to write a String into a file on a machine located on the network from a web application.Can anybody help me out please.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
On Windows only Spyware and Virus programs are allowed to do this.

Seriously, if you want the user to hit a web page that somehow writes to their local drives, you'll bump into Windows security policies. We've done this kind of thing through Applets. Really don't know if you can do it with JavaScript.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Chetan Bengaluru
Greenhorn

Joined: Feb 15, 2005
Posts: 9
Originally posted by Stan James:
On Windows only Spyware and Virus programs are allowed to do this.

Seriously, if you want the user to hit a web page that somehow writes to their local drives, you'll bump into Windows security policies. We've done this kind of thing through Applets. Really don't know if you can do it with JavaScript.


Hi,

The scenario is as follows.
#1) After logging in the user edits/creates a profile.
#2) This info is then fed into a Stored procedure which returns a ref cursor.
#3)A resultset is obtained from the cursor and then i iterate through the resultset.The contents fetched should then be written onto the directory specified by the user in step 1.

Can you please suggest a way out for this.I have no clue as to how i get a handle to the user's machine even if I am equipped with his host information.I can write into the server at some location but i am lost when it comes to writing into a file on another machine on the same network.

Any help/directions is most welcome.
Thanks & Regards
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
The standard method for this is to provide a link to the user, for example "Download Results" that points to a JSP/servlet that performs the query and returns the data to be saved.

The user then right-clicks on the link and selects "Save Target As..." to specify the location to which the data should be saved.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: writing a file onto a client from a web application