Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Write file to a client system  RSS feed

 
Mrigasira Srinivas
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am attempting to create a file consisting of data I retrieve from the database on a browser. I am able to create the file on the server side. Can anyone let me know how can I do it on the client side? Essentially, I should be able to ask the user to choose a folder to save the file and write the file there.
I also want to know how can I insert carriage returns in a string that I am writing into a text file.
Any help in this regards would be appreciated.
 
prabhat gupta
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi yamini,
You cannot create a file on the client side but you can first generate the file on the server and ask the client to download the file.creating a file on the client side requires access to the client resources which is not possible through a browser.So you have to first write data to the file on the server and allow the user to download it.
I hope that solves your problem to some extent.It may not however be the perfect solution.
Bye for now.
 
Siva Prasad
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
a) As Prabhat mentioned, usually there will be many security issues come into picture if you want to do anything on the client side. One must keep this in mind, whenever they write any applets or any java related stuff which deals with browsers.
b) You can use writeLine() method from the class RandomAccessFile to write any lines into a file. This feeds in carriage returns at the end of each line.

cheers
Siva
 
Dinah S.
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also do this through applets using an RSA certificate (either official or self-signed). After a user has accepted you as a trusted site, you will have access to their file directory. We are using this to allow users on our intranet to download binary files, since we have 60,000+ files. Self-signed works well for intranet.

Some useful websites for self-signed certificates are:
http://www.suitable.com/docs/signing.html
http://java.sun.com/products/plugin/1.3/docs/nsobjsigning.html
http://forum.java.sun.com/thread.jsp?forum=63&thread=174214
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!