SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru htown's Avatar
    Join Date
    Mar 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Start download on click

    I have an image on a site that I want people to be able to click on to download the higher res version of it. I am assuming there is some Javascript needed for this, if so can someone tell me what it is or where to find it and if not, how else I can accomplish this.

    Thank you,
    Houston
    Houston Brown
    Split Light Designs
    Bringing your ideas to light.

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,609
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Simple HTML link pointing to a server page (ASP, PHP etc.) that retrieves the hi-res image, sets a download header and streams the image to the browser.

    Alternatively, a simple link pointing to the hi-res image. This will show in the browser but the user will be able to right-click and Save As (syntax depends on browser).
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Guru htown's Avatar
    Join Date
    Mar 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do not want a larger image showing up when you click the image, I want a dialog box that asks the user where he wants to save the file. How do you do that?
    Houston Brown
    Split Light Designs
    Bringing your ideas to light.

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,609
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    First paragraph/sentence of my previous reply. You don't do it with JavaScript.
    Ian Anderson
    www.siteguru.co.uk

  5. #5
    SitePoint Guru htown's Avatar
    Join Date
    Mar 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So I have to know asp or php then to do this?
    Houston Brown
    Split Light Designs
    Bringing your ideas to light.

  6. #6
    SitePoint Zealot the DtTvB's Avatar
    Join Date
    Jul 2006
    Location
    Thailand
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes. You need to know how to alter the output header and send the MIME type.

    But I would ZIP the image file and tell user to download the Zipfile instead.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •