3 Replies Latest reply on Aug 5, 2006 5:18 PM by Newsgroup_User

    How do I force a file to start downloading

    jimmylharrell Level 1
      Okay looking for a quik answer. This can be javascript or coldfusion but basically I have some text that is hyperlinked to a jpg image. Something like this: <a href="../.../images/example.jpg">Example Image</a>. Now when the user clicks on the link it will take them to a page displaying the image. But I don't want this.

      What I want is for them to have the dialog box that says "open" or "save". You've seen what I'm talking about. Certain types of files forces you to download them. Basiclly , allowing them to open the jpg in the current browser window or download it to their desktop and open it up. Is there a javascript or coldfusion tag to do this? Some thing like onClick=download????. or <cf download>?????. Hope I'm posing this question correctly.
        • 1. Re: How do I force a file to start downloading
          Level 7
          Make a zipfile from your picture
          Cheers
          www.SamDesign.be

          "jimmylharrell" <jimmy.harrell@elkcorp.com> a �crit dans le message de news:
          eb2fjv$2nu$1@forums.macromedia.com...
          > Okay looking for a quik answer. This can be javascript or coldfusion but
          > basically I have some text that is hyperlinked to a jpg image. Something
          > like
          > this: <a href="../.../images/example.jpg">Example Image</a>. Now when the
          > user
          > clicks on the link it will take them to a page displaying the image. But I
          > don't want this.
          >
          > What I want is for them to have the dialog box that says "open" or "save".
          > You've seen what I'm talking about. Certain types of files forces you to
          > download them. Basiclly , allowing them to open the jpg in the current
          > browser
          > window or download it to their desktop and open it up. Is there a
          > javascript or
          > coldfusion tag to do this? Some thing like onClick=download????. or <cf
          > download>?????. Hope I'm posing this question correctly.
          >


          • 2. Re: How do I force a file to start downloading
            jimmylharrell Level 1
            no, I know a zip will force a download but I'm talkinga bout with just a plain jpg file.
            • 3. Re: How do I force a file to start downloading
              Level 7
              If you can configure the server using a control panel or other means, you
              can alter the mime type, forcing a download on most browsers.

              if you hosting is Apache for instance- You would create a new folder, for
              just the files you want to force download.
              You'd put an .htaccess file in this folder, with this line:
              ForceType applicaton/octet-stream

              You could not use anything in that folder in any pages-
              So if you want to show the image in a page, you'd have to use a copy of it
              that wasn't in that special folder.

              > no, I know a zip will force a download but I'm talkinga bout with just a plain
              > jpg file.