Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Download file on client machine at particular location

 
Chhaya Dhanani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Chhaya Dhanani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic