Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to enable downloads

 
Bartender
Posts: 1752
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a bit confused about how I could enable (start) a file download from a JSP page.
For example, if a user clicked an image that they wanted to download, what's the technique to start the download happening?
I'm thinking this is easy, but I can't find any references to it (or I'm looking up the wrong keywords).
Thanks for anyone's reply or suggestions.
-- Mike
 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your jsp file result is an html page.
so, if it's an html page and you have a link to your file in it, the user clicks and the whole thing works ..
 
Mike London
Bartender
Posts: 1752
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Huh?
I have no idea what you're saying.
What I'm asking is what would you have to implement on the server side so that if the user clicks on it you download a file.
Is this an FTP link of some kind?
Can you be a little more specific?
Thanks.
-- Mike
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When your server reply to the browser, you declare the content-type of the response.
The default is text/html.
But if you declare the content type as any MIME type the browser can not manage, it will just prompt the download dialog window instead of display the response.
HTH
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
store this image in a zip file and link the image to this zip file.
now when the user will click on the image to download the browser functionality will ask him to download or not.
hope this willl help u.
 
Bras cause cancer. And tiny ads:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic