aspose file tools*
The moose likes I/O and Streams and the fly likes Download file on client machine at particular location 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 "Download file on client machine at particular location" Watch "Download file on client machine at particular location" New topic
Author

Download file on client machine at particular location

Chhaya Dhanani
Ranch Hand

Joined: Apr 11, 2001
Posts: 70
hi all,
I am developing pages for Clarfy 12.5 CRM web application.
We are using Weblogic app server 8.1.

One of my requirements is, on click of hyperlink, a file is to be created dynamically and downloaded at a particular location on the client's machine.
In case the file is already present, it has to be over written.

is there any way where we can access the client's system and store the file at the required folder?
I feel one cannot access the client machine when the code is being executed on the server..
Is there a way, we can force the download dialog to appear and ask the end-user to choose the location??

Please help me on this. This is an SOS!!

Thanx in advance..
Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342
Is there a way, we can force the download dialog to appear and ask the end-user to choose the location??


You won't be able to make a hyperlink in browser save a file to a particular location, but you could maybe force a save-file dialog by setting the mime type of the data to something that the browser will not recognise. Is the link to an actual file, or to a servlet URL or similar that will stream the data directly?


SCJP 1.4, www.gsi3d.org.uk
Chhaya Dhanani
Ranch Hand

Joined: Apr 11, 2001
Posts: 70
Hi Ben, thanx for the prompt reply,
The file is actually to be created dynamically on click of the hyperlink and saved on the client machine. The file is a .ARTask file which is used by Remedy Tool.
The jsp page is actually a part of CLarify CRM 12.5 thin client web architecture.
Can u help me as to how to set the type of file to something which the browser won't understand and hence force a save-file dialog box?
Also, is it possible to have a specified location say "c:\clarify" to appear in the dialog box as default ?

Thanx a lot in advance,
Appreciate your prompt reply ..
Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342
Well, in a servlet I use to stream some file content straight to the browser I just make up a mime-type that I know the system will not recognise



this causes the browser to display a file download dialog from which you can save. I don't think there would be a way to specify a default directory though.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
If you are allowed to dowload security policy files, you could make an Applet that writes the file anywhere you like. Your hyperlink might be coded with onClick() to run some JavaScript that tells the applet to request a file from the server and write it to disk. It could even display progress or some indicator that it's working. We do this kind of thing with captive users inside a corporate network, but I would probably not ask public users to do accept security policy files out in the world. For those users, I like the previous suggestion.


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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Download file on client machine at particular location