Loading ...
Sorry, an error occurred while loading the content.
 

Re: Downloading Files

Expand Messages
  • jorigami
    ... They are going to learn right-click sooner or later, so why not make that sooner? Most of the people I ve teached that the person who said don t use the
    Message 1 of 16 , Aug 21, 2002
      --- In ntb-html@y..., "wilkinsonm" <mikew@w...> wrote:
      > I'm trying to get away from asking computer amateurs to
      > right-click, unzip or anything like that.

      They are going to learn right-click sooner or later, so why not
      make that sooner? Most of the people I've teached that the person
      who said "don't use the right mouse button" was fool have been
      happy with the extra functionality.

      I have seen people hovering mouse pointer above a link, then typing
      as much of that as they can remember into an email, then repeating
      until full url is complete. Quite much easier with rmb.


      Jorma
    • Rudolf Horbas
      ... Mike, that s basically a good idea -- not because it keeps users stupid by not letting them use the right mouse button, but because it s comfortable. I
      Message 2 of 16 , Aug 21, 2002
        wilkinsonm wrote:
        > Yes, I've had the same experience. I'm trying to get away from asking
        > computer amateurs to right-click, unzip or anything like that. I just
        > want to say "click here to download."

        Mike,

        that's basically a good idea -- not because it keeps users stupid by not
        letting them use the right mouse button, but because it's comfortable. I
        believe that Lotta's idea to replace the image or html-header with an
        application header might work. If You put the files to download into a
        separate directory of the server and create a .htaccess-file in this
        directory with the content:

        AddType "application/octet-stream" "htm"
        AddType "application/octet-stream" "gif"
        AddType "application/octet-stream" "jpg"

        I just tried:

        * Mozilla 1.0 works with htm and gifs and offers a download dialog, but
        shows the jpg-File.

        * MSIE obviously ignores the header and shows all 3 types files. Bad.
        This is not what You want.

        Do You have PHP on Your server?

        Rudi
      • Rudolf Horbas
        Mike, I played around with Your problem a bit; problem is that MSIE 5.5/6.0 has a bug concerning header handling, so most standard things don t work on all
        Message 3 of 16 , Aug 21, 2002
          Mike,

          I played around with Your problem a bit; problem is that MSIE 5.5/6.0
          has a bug concerning header handling, so most standard things don't work
          on all browsers.

          I didn't manage to download jpegs correctly, they appear to be broken;
          html and GIFs work, though. (all quickly tested locally under Apache/PHP
          for Win32, so no guarantee for *nix systems!)

          What I've come up with is the following (hope Yahoo lets the code
          through properly):

          1. HTML file "index.htm":
          -------------------------

          <HTML><HEAD><TITLE>My Downloads</TITLE><BODY>
          <A HREF="download.php?file=test.jpg">JPG</A> (bad output)<BR>
          <A HREF="download.php?file=test.gif">GIF</A><BR>
          <A HREF="download.php?file=test.htm">HTML</A>
          </BODY></HTML>

          2. PHP file "download.php":
          ---------------------------

          <?PHP

          /****************** Warning!!! **********************************
          + Do not use download.php as-it-is; it does not check for security!
          + Depending on Your hoster's configuration, anyone could download
          + files from other directories, even outside Your wwwroot, by
          + using the url e.g.: download.php?file=../../usr/etc/passwords
          + This is a very serious threat!!!
          ******************************************************************/

          // if $file is specified:
          if ( $file != "" )
          {
          // send "fake" header:
          header ("Content-type: application/octet-stream");
          // force download:
          header ("Content-Disposition: attachment; filename=$file");
          // check whether $file exists at all:
          if ( file_exists ("$file") )
          {
          // open $file for reading:
          $fp = fopen($file, 'r');
          // output content of $file:
          fpassthru($fp);
          // close $file
          // prints an error message into downloaded
          // html documents (???),
          // so remove comment slashes for GIFs:
          // fclose($fp);
          }
          else echo "$file does not exist!";
          }
          else echo "no file specified!";
          ?>

          Hope this is useful,
          Rudi
          --
          9. "I will not include a self-destruct mechanism unless absolutely
          necessary. If it is necessary, it will not be a large red button
          labelled "Danger: Do Not Push". The big red button marked "Do Not Push"
          will instead trigger a spray of bullets on anyone stupid enough to
          disregard it. Similarly, the ON/OFF switch will not clearly be labelled
          as such."
          From: The Top 100 Things I'd Do If I Ever Became An Evil Overlord
          (http://www.eviloverlord.com/lists/overlord.html)
          Copyright 1996-1997 by Peter Anspach
        • Rudolf Horbas
          ... Ok, the jpegs are broken when they re opened in text mode (default of fopen() ) on a Windows-system; in that case, use the following in download.php: (...)
          Message 4 of 16 , Aug 21, 2002
            Rudolf Horbas wrote:
            > I didn't manage to download jpegs correctly, they appear to be broken;
            > html and GIFs work, though.

            Ok, the jpegs are broken when they're opened in text mode (default of
            fopen() ) on a Windows-system; in that case, use the following in
            download.php:

            (...)
            // open file for reading in binary mode on Win-systems:
            $fp = fopen($file, 'rb');
            (...)

            As You'll usually (and hopefully) be dealing with a *nix OS, the code of
            my previous post should work ok.

            Rudi
            --
            84. "I will not have captives of one sex guarded by members of the
            opposite sex."
            From: The Top 100 Things I'd Do If I Ever Became An Evil Overlord
            (http://www.eviloverlord.com/lists/overlord.html)
            Copyright 1996-1997 by Peter Anspach
          • Rudolf Horbas
            ... Mike, OK, here s a low-tech solution, without any scripting. Very easy, secure, clean, water-proof (as far as I can see). A bit of a hack. All You need
            Message 5 of 16 , Aug 21, 2002
              wilkinsonm wrote:
              > Normally, if you provide a link to an HTML, text, gif, jpeg, etc.
              > file, your browser will recognize the file type and try to display it.
              > Is there any way to prevent display of the file and download it to the
              > client computer? This works automatically if I click on a link to a
              > Zip file or .exe file. Any ideas?

              Mike,

              OK, here's a "low-tech" solution, without any scripting. Very easy,
              secure, clean, water-proof (as far as I can see). A bit of a hack. All
              You need is the right to put .htaccess-files on Your server:

              As mentioned in a previous mail, You'd have to re-define the file types
              You need in a .htaccess file.
              *But*, as this does not work with all Browsers on all file types (MSIE
              "sniffs" the file type and overrides Your settings), You create a fake
              file type (e.g. "faketype"); this is *not* overridden by MSIE and works
              on MSIE and Mozilla 1.0 for prompting a download dialog with the correct
              file name.

              file ".htaccess" in Your download directory:
              --------------------------------------------
              AddType "application/faketype" "htm"
              AddType "application/faketype" "gif"
              AddType "application/faketype" "jpg"

              ("faketype" is maybe not a good name, as it may be too conspicuous in
              the download dialog (of Mozilla). Better choose a friendlier one, e.g.
              "downloadfile")

              Hint: When saving the ".htaccess"-file in NoteTab, put the name in "",
              or it will be saved as ".htaccess.txt"!

              Rudi
              --
              58. "If it becomes necessary to escape, I will never stop to pose
              dramatically and toss off a one-liner."
              From: The Top 100 Things I'd Do If I Ever Became An Evil Overlord
              (http://www.eviloverlord.com/lists/overlord.html)
              Copyright 1996-1997 by Peter Anspach
            • loro
              ... It wasn t my idea! I just mentioned that it s possible. I wouldn t recommend doing it. :-) L.
              Message 6 of 16 , Aug 21, 2002
                At 11:11 2002.08.21, Rudolf Horbas wrote:
                > Lotta's idea to replace the image or html-header with an
                >application header

                It wasn't my idea! I just mentioned that it's possible. I wouldn't
                recommend doing it. :-)

                L.
              • Fay
                Perhaps in a few words you could tell the user to right click. People spend so much money on pcs and no-one tells them how to use them. Then they appear
                Message 7 of 16 , Aug 21, 2002
                  Perhaps in a few words you could tell the user to right click. People spend
                  so much money on pcs and no-one tells them how to use them. Then they appear
                  amateur or foolish because of the "intuitive" myth, and they get only a tiny
                  %age of the use they should get from their machines.
                • jorigami
                  ... Here is some info about Content-type based problems: http://ppewww.ph.gla.ac.uk/~flavell/www/content-type.html Jorma
                  Message 8 of 16 , Aug 21, 2002
                    --- In ntb-html@y..., Rudolf Horbas <Rudolf.Horbas@g...> wrote:

                    > idea to replace the image or html-header with an application
                    > header might work.

                    > * Mozilla 1.0 works with htm and gifs and offers a download dialog,
                    > but shows the jpg-File.
                    > * MSIE obviously ignores the header and shows all 3 types files. Bad.


                    Here is some info about Content-type based problems:

                    http://ppewww.ph.gla.ac.uk/~flavell/www/content-type.html


                    Jorma
                  • wilkinsonm
                    I was away for a couple of days - sorry about the slow response. Thanks for the interesting suggestions. I will try the .htaccess approach. Mike Wilkinson ...
                    Message 9 of 16 , Aug 24, 2002
                      I was away for a couple of days - sorry about the slow response.

                      Thanks for the interesting suggestions. I will try the .htaccess approach.

                      Mike Wilkinson


                      --- In ntb-html@y..., Rudolf Horbas <Rudolf.Horbas@g...> wrote:
                      > wilkinsonm wrote:
                      > > Normally, if you provide a link to an HTML, text, gif, jpeg, etc.
                      > > file, your browser will recognize the file type and try to display it.
                      > > Is there any way to prevent display of the file and download it to the
                      > > client computer? This works automatically if I click on a link to a
                      > > Zip file or .exe file. Any ideas?
                      >
                      > Mike,
                      >
                      > OK, here's a "low-tech" solution, without any scripting. Very easy,
                      > secure, clean, water-proof (as far as I can see). A bit of a hack. All
                      > You need is the right to put .htaccess-files on Your server:
                      >
                      > As mentioned in a previous mail, You'd have to re-define the file types
                      > You need in a .htaccess file.
                      > *But*, as this does not work with all Browsers on all file types (MSIE
                      > "sniffs" the file type and overrides Your settings), You create a fake
                      > file type (e.g. "faketype"); this is *not* overridden by MSIE and works
                      > on MSIE and Mozilla 1.0 for prompting a download dialog with the
                      correct
                      > file name.
                      >
                      > file ".htaccess" in Your download directory:
                      > --------------------------------------------
                      > AddType "application/faketype" "htm"
                      > AddType "application/faketype" "gif"
                      > AddType "application/faketype" "jpg"
                      >
                      > ("faketype" is maybe not a good name, as it may be too conspicuous in
                      > the download dialog (of Mozilla). Better choose a friendlier one, e.g.
                      > "downloadfile")
                      >
                      > Hint: When saving the ".htaccess"-file in NoteTab, put the name in "",
                      > or it will be saved as ".htaccess.txt"!
                      >
                      > Rudi
                      > --
                      > 58. "If it becomes necessary to escape, I will never stop to pose
                      > dramatically and toss off a one-liner."
                      > From: The Top 100 Things I'd Do If I Ever Became An Evil Overlord
                      > (http://www.eviloverlord.com/lists/overlord.html)
                      > Copyright 1996-1997 by Peter Anspach
                    • Jody
                      Hi Mike and Others, Here s my two cents, but maybe only worth a cent. ;-} A long time ago I would rename the file from say image.gif to image.zip explaining in
                      Message 10 of 16 , Aug 24, 2002
                        Hi Mike and Others,

                        Here's my two cents, but maybe only worth a cent. ;-}

                        A long time ago I would rename the file from say image.gif to
                        image.zip explaining in a few words to rename the file after
                        downloading. I had about 3 months Internet experience at the
                        time not knowing we could right click and of course have since
                        ceased using it.

                        Bravo to you Fay! I'm certainly not trying to put you down Mike,
                        but if we do things so that the user is prevented from learning
                        new things, even basic stuff, then we are to blame for their
                        ignorance. I understand you are trying to get away from adding a
                        short note or answering/telling people to right click, but IMHO
                        that helps keep them ignorant. Just by telling them to right
                        click it normally opens up a whole new world for them.

                        Of course there will still be those that do not read the short
                        note, nor how to find the file once it is downloaded. I get
                        quite a few posts saying that when they try to open NoteTab Light
                        to use it by clicking on it on their desktop that Acrobat,
                        Notepad, Media Player, etc. just shows it to be a bunch of
                        garbage text. I then use NoteTab's PasteBack feature (which is
                        almost always on for me to get the text I need returned to me as
                        in FAQs) to get the text pasted in my eMail program telling them
                        they need to decompress the file, blah, blah, blah. I answer
                        them walking them through the whole procedure knowing that they
                        do not know much since they are trying to open a ZIP file in
                        whatever program. My point in telling all that is that no matter
                        how many times we see all over the net to get WinZip or another
                        compression utility, there are those that do not read what they
                        need to do. Eventually they find out whether by me or
                        somebody/someplace else. That is good; they learn their lesson
                        that way and remember it.

                        I try to do my part in removing the "eternal newbies" from the
                        web, by not doing everything for them. Trying to get them to do
                        things with the available features/tools helps us all out in that
                        they can tell others, some of the bandwidth is spared Internet
                        wide because of people downloading MB over and over because they
                        thing the download must be bad, and other reasons.

                        >Perhaps in a few words you could tell the user to right click.
                        >People spend so much money on pcs and no-one tells them how to
                        >use them. Then they appear amateur or foolish because of the
                        >"intuitive" myth, and they get only a tiny %age of the use they
                        >should get from their machines.


                        Happy HTML'n!
                        Jody

                        http://www.notetab.net

                        Subscribe, UnSubscribe, Options
                        mailto:ntb-html-Subscribe@yahoogroups.com
                        mailto:ntb-html-UnSubscribe@yahoogroups.com
                        http://groups.yahoo.com/group/ntb-html
                      Your message has been successfully submitted and would be delivered to recipients shortly.