This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

File Download Dialog

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to Java Script. I have a download button. When the button is clicked, I want to pop-up a File Download dialog box with the options open, save .. .I am not sure how to call the File download dialog box and also I need to download an Excel file when I click on the download button.I tried to use document.execCommand('saveas' ..). But it directly opens a Save As Html dialog and saves the html file. Can any one please explain me how to open File download dialog.
Thanks a lot !!!
 
Marshal
Posts: 67340
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say "download" you mean from the server to the client, correct? (If not, there is an entry in the JSP FAQ regarding file uploading that you may find helpful.)

All you need to do is to create a link to the file and make sure that your browser is set up properly to handle the MIME type of the file correctly.

If you want more control over the download, you will need to wirte a servlet (or other server-side mechanism) to handle the file streaming.
[ November 22, 2005: Message edited by: Bear Bibeault ]
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If u have a copy in server and try downlading it in client side,then u can try this,

location.href="foldername/filename.zip"
 
Bear Bibeault
Marshal
Posts: 67340
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
deepa, JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

Please read this for more information.

thanks,
bear
Forum Bartender
 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!