• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Saving File to Client Machine.

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I recently posted about uploading files to the server from the client, now, I guess I techinically want to download files to the client.

The consultants on a big project basically want to be able to do this, and I am investigating how possible this would be. We are using Struts and Weblogic 8.1. I think it is probably impossible, but I don't want to sound too negative, and figured I don't really know everything, so should investigate.

We have an application, where users can import items to the database, and also export things from the database, to XML files.

Up until today, we had to make the users import and export things to and from files on the server. I have now managed to allow them to import files from their client, but have not sussed how to allow them to export files to their machine, without having to make them hit the mouse and select save as.

This is an acceptable solution if there is no other way, it is just that if we save tons of files to the server, then allow the user to save as, the server will eventually have lots of files on it that are not meant to be there.

The user inputs the file name, so I was wondering if there was anyway of downloading information to the file name submitted without save as?

Thanks,
Gillian
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

export files to their machine, without having to make them hit the mouse and select save as.



No, there is no way to do this. Imagine the security implications if any web site could silently place files on the client.

You'd need something like a signed applet to be able to accomplish this. (Or an ActiveX control if you're tunnel-visioned into Microsoft).
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not without some client side code. If you didn't want the client to have to use the browser supplied method of downloading files you would have to implement another one yourself.

I'd start to think about some good way to clean up these temp files on you server instead and not bother too much about the "save as" stuff.

(unless its esential, and its an intranet site - in which case you could use FTP)
[ November 08, 2004: Message edited by: Paul Sturrock ]
 
Gillian Daniel
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
I didn't think it was possible (for the security reasons), but I just had to check, since the user is responsible for typing in the file name, or providing the file name I thought it just MIGHT be possible. But you have confirmed what I already thought, and I just wanted to make sure, before telling everyone it was impossible, and then finding out it was possible.

Thanks again,
Gillian
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I think u can do it by adding all the contents first in the stringbuffer and store it on the server and give the path of that text file to the hyperlink download
but this solution has a drawback that every time there we are making ,whether the client download the page or not.
you can solve it if u save the text in the stringbuffer to the disk only when the client click the download link

If i am wrong then please sugest me
BY
reply
    Bookmark Topic Watch Topic
  • New Topic