how to "Click on an image to download it, not open in browser" ??

Discussion in 'HTML & Website Design' started by Jeehan, Oct 29, 2010.

  1. #1
    I want to make this link will start downloading the image, not opening in browser.

    Thank you.
     
    Jeehan, Oct 29, 2010 IP
  2. hirensoni913

    hirensoni913 Peon

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It needs code. But no one will able to give u a sample code because you have not mentioned which platform are you working on.
     
    hirensoni913, Oct 29, 2010 IP
  3. Jeehan

    Jeehan Well-Known Member

    Messages:
    1,578
    Likes Received:
    31
    Best Answers:
    1
    Trophy Points:
    115
    #3
    thanks for the reply. I am using PHP
     
    Jeehan, Oct 29, 2010 IP
  4. KingOle

    KingOle Peon

    Messages:
    69
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Can you right click on the link and click save as target? Or are you looking for some code which automatically asks you to download it? Another solution may be to zip the image first?
     
    KingOle, Oct 29, 2010 IP
  5. Jeehan

    Jeehan Well-Known Member

    Messages:
    1,578
    Likes Received:
    31
    Best Answers:
    1
    Trophy Points:
    115
    #5
    ya i am looking for the code, server side
     
    Jeehan, Oct 29, 2010 IP
  6. lukefowell89

    lukefowell89 Peon

    Messages:
    182
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    What you need to do is make a new php page for the image called e.g. download-image.php. This page will have headers saved on it with the file name and content type attached and an "exit()" command to close the page. I dont have the sample code to hand but look up "force download php" in google and you will find your answer
     
    lukefowell89, Oct 29, 2010 IP
  7. karthimx

    karthimx Prominent Member

    Messages:
    4,959
    Likes Received:
    127
    Best Answers:
    2
    Trophy Points:
    340
    #7
    a href Image will always open in a new window. if you want to download them make the image as .zip file and give that link in a href.
     
    karthimx, Oct 29, 2010 IP