File downloading from HTML page

Discussion in 'HTML' started by MP, Apr 10, 2006.

  1. MP

    MP Guest

    On my pages I provide links for downloading binary files.
    But for some reason, when a link is clicked, browser downloads and opens
    the file in text format (i.e. "funny" text appears on the screen).
    And if I right-click the link and select the "Save target as...",
    extension ".htm" is incorrectly added on the file name. If I provide the
    correct extension, then it downloads properly.

    What is wrong? Example available here:
    http://www.elisanet.fi/matti.puputti/download/files/LaRouteNapoleon_en.htm


    Thanks in advance,

    MP
    http://www.elisanet.fi/matti.puputti/index_en.htm
     
    MP, Apr 10, 2006
    #1
    1. Advertising

  2. MP

    Steve Pugh Guest

    MP wrote:
    > On my pages I provide links for downloading binary files.
    > But for some reason, when a link is clicked, browser downloads and opens
    > the file in text format (i.e. "funny" text appears on the screen).
    > And if I right-click the link and select the "Save target as...",
    > extension ".htm" is incorrectly added on the file name. If I provide the
    > correct extension, then it downloads properly.
    >
    > What is wrong? Example available here:
    > http://www.elisanet.fi/matti.puputti/download/files/LaRouteNapoleon_en.htm


    The files (e.g.
    http://www.elisanet.fi/matti.puputti/download/files/LaRouteNapoleon.gdb)
    are being served with the HTTP Content-Type header set to text/html.

    In other words your server is telling browsers that these are HTML
    files. Browsers are thus acting correctly based on what they've been
    told.

    You need to change the server configuration to serve a more appropriate
    HTTP header with these files.

    Steve
     
    Steve Pugh, Apr 10, 2006
    #2
    1. Advertising

  3. MP wrote:

    > On my pages I provide links for downloading binary files.
    > But for some reason, when a link is clicked, browser downloads and opens
    > the file in text format (i.e. "funny" text appears on the screen).
    > And if I right-click the link and select the "Save target as...",
    > extension ".htm" is incorrectly added on the file name. If I provide the
    > correct extension, then it downloads properly.
    >
    > What is wrong? Example available here:
    > http://www.elisanet.fi/matti.puputti/download/files/LaRouteNapoleon_en.htm


    Your server serves these files with a Content-Type of text/html. You seem to
    have an Apache server, so creating a .htaccess file (if you do not have one
    already) with the content

    AddType application/octet-stream .kmz .gdb

    in your root directory should fix this problem (add any other extension you
    need to the list). There might be more appropriate mime-types than
    application/octet-stream for your files - I have not looked it up.

    --
    Benjamin Niemann
    Email: pink at odahoda dot de
    WWW: http://pink.odahoda.de/
     
    Benjamin Niemann, Apr 10, 2006
    #3
  4. MP

    Andy Dingley Guest

    MP wrote:
    > On my pages I provide links for downloading binary files.
    > But for some reason, when a link is clicked, browser downloads and opens
    > the file in text format (i.e. "funny" text appears on the screen).


    Your server is returning a HTTP content-type of text/html This is the
    default (for many servers) for anything that isn't specifically
    recognised. The browser then treats this as text content and shows it
    to you.

    As you're running Apache, this is easy to fix. Web search a tutorial on
    ".htaccess" and it should explain how. You can do this yourself,
    without needing to bother the server admins (for almost all sensible
    Apache sites). Google also (AFAIR) have some specific notes on the best
    way to serve up these KMZ documents.
     
    Andy Dingley, Apr 10, 2006
    #4
  5. MP

    Guest

    Make a new apache request . Fill the MIME type of your apache header to
    your file format.Then use "send_http_header" .Every thing should work
    properly.


    Niraj
     
    , Apr 10, 2006
    #5
  6. MP

    MP Guest

    Ok, so I already received a bunch or replies (good so!).
    As the server is run by my ISP, and I only have access to one of its
    folders (where i upload my pages to), I assume I will have to contact my
    ISP and ask them to do the actual job.
    Just before doing so, could someone tell whether I really could update
    the .htaccess file by myself? With my XP?

    Thanks again,

    MP
     
    MP, Apr 10, 2006
    #6
  7. MP

    Andy Dingley Guest

    MP wrote:

    > As the server is run by my ISP, and I only have access to one of its
    > folders (where i upload my pages to), I assume I will have to contact my
    > ISP and ask them to do the actual job.


    What part of this are you having the problem in understanding?
    > > As you're running Apache, this is easy to fix. Web search a tutorial on
    > > ".htaccess" and it should explain how. You can do this yourself,
    > > without needing to bother the server admins (for almost all sensible
    > > Apache sites).


    Nor do servers have "folders". Windows desktops have folders, and they
    remove all sharp edges that you don't hurt yourself either. Real
    computers have directories. You (or at least your ISP) appears to be
    running Apache on Solaris, which counts as real.
     
    Andy Dingley, Apr 10, 2006
    #7
  8. MP

    SpaceGirl Guest

    Andy Dingley wrote:
    > MP wrote:
    >
    > > As the server is run by my ISP, and I only have access to one of its
    > > folders (where i upload my pages to), I assume I will have to contact my
    > > ISP and ask them to do the actual job.

    >
    > What part of this are you having the problem in understanding?
    > > > As you're running Apache, this is easy to fix. Web search a tutorial on
    > > > ".htaccess" and it should explain how. You can do this yourself,
    > > > without needing to bother the server admins (for almost all sensible
    > > > Apache sites).

    >
    > Nor do servers have "folders". Windows desktops have folders, and they
    > remove all sharp edges that you don't hurt yourself either. Real
    > computers have directories. You (or at least your ISP) appears to be
    > running Apache on Solaris, which counts as real.


    As do Macs, and some Linux builds. The whole "windowing" environment
    removes the sharp edges of computers too. Get back in your command line
    box :p In the real world people dont care about these technical things,
    and if the "folders" metaphore helps people understand a particular
    computing concept better then that's great. Resisting anything that
    aids understanding is just dumb. Go read a book and XP (and I dont mean
    Windows).
     
    SpaceGirl, Apr 10, 2006
    #8
  9. MP

    JDS Guest

    JDS, Apr 10, 2006
    #9
  10. MP

    MP Guest

    Building an .htaccess file does not seem like a difficult task, and I
    have uploaded one to the "root" of my home site (I know it is not the
    "real" root, but I simply call it "root" as it is the main folder where
    I have access to, i.e. www.elisanet.fi/matti.puputti/. Rather than being
    religious, I try to concentrate on the issue in hand).

    But the problem seems to be more on how to tell Apache to take account
    of it.
    Some tutorials I have read so far (yesterday and before) are telling me
    to re-start Apache after updating the file. But I don't know how to do
    the re-starting. Somehow it doesn't seem to make sense that a customer
    of an ISP would have access to shoot down / restart an application on
    the ISP server?

    So I seem to be missing the answer on : "How to activate the new
    ..htaccess settings?".
    And if the answer is "Simply upload the file, that's all!", then either
    (i) my ISP doesn't allow me to use .htaccess, or (ii) some attributes of
    the file are still wrong. Right?


    MP
     
    MP, Apr 11, 2006
    #10
  11. On Tue, 11 Apr 2006 05:52:35 GMT, MP <> wrote:

    >So I seem to be missing the answer on : "How to activate the new
    >.htaccess settings?".
    >And if the answer is "Simply upload the file, that's all!", then either
    >(i) my ISP doesn't allow me to use .htaccess, or (ii) some attributes of
    >the file are still wrong. Right?


    Can you ask your ISP ? The file (AddType application/octet-stream .kmz
    ..gdb)is definitely there. There is an Apache setting which tells it to
    check or not for .htaccess files. I think it can be specified on a user
    by user basis.

    --
    Steven
     
    Steven Saunderson, Apr 11, 2006
    #11
  12. Steven Saunderson <> wrote:

    > On Tue, 11 Apr 2006 05:52:35 GMT, MP <> wrote:
    >
    >>So I seem to be missing the answer on : "How to activate the new
    >>.htaccess settings?".
    >>And if the answer is "Simply upload the file, that's all!", then either
    >>(i) my ISP doesn't allow me to use .htaccess, or (ii) some attributes of
    >>the file are still wrong. Right?

    >
    > Can you ask your ISP ?


    Given the abbreviated address www.elisanet.fi/matti.puputti/ , I'm afraid the
    answer will be (i). This particular service provider (Elisa a.k.a. Kolumbus)
    does not let its customers affect server behavior with .htaccess, i.e. the
    server has been set to ignore .htaccess. This applies to the normal web space
    that private people have as customers. There are more expensive alternatives,
    sold basically as business web space. It's price differentiation of a kind.
    In other words, they intentionally reduce the functionality, and you have to
    pay considerably more to get what many people regard as normal service.

    (I once asked them about this. The answer was obscure and mentioned "security
    issues", of course.)

    > The file (AddType application/octet-stream .kmz
    > .gdb)is definitely there.


    Yes, and it is world-readable, as it should be. When the server has been set
    to use customer .htaccess files, nothing more needs to be done than to upload
    a correct .htaccess file and check the protections (read access to all).

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Apr 11, 2006
    #12
  13. MP

    MP Guest

    Jukka K. Korpela wrote:
    > Steven Saunderson <> wrote:
    >
    >> On Tue, 11 Apr 2006 05:52:35 GMT, MP <> wrote:
    >>
    >>> So I seem to be missing the answer on : "How to activate the new
    >>> .htaccess settings?".
    >>> And if the answer is "Simply upload the file, that's all!", then either
    >>> (i) my ISP doesn't allow me to use .htaccess, or (ii) some attributes of
    >>> the file are still wrong. Right?

    >> Can you ask your ISP ?

    >
    > Given the abbreviated address www.elisanet.fi/matti.puputti/ , I'm afraid the
    > answer will be (i). This particular service provider (Elisa a.k.a. Kolumbus)
    > does not let its customers affect server behavior with .htaccess, i.e. the
    > server has been set to ignore .htaccess. This applies to the normal web space
    > that private people have as customers. There are more expensive alternatives,
    > sold basically as business web space. It's price differentiation of a kind.
    > In other words, they intentionally reduce the functionality, and you have to
    > pay considerably more to get what many people regard as normal service.
    >
    > (I once asked them about this. The answer was obscure and mentioned "security
    > issues", of course.)
    >
    >> The file (AddType application/octet-stream .kmz
    >> .gdb)is definitely there.

    >
    > Yes, and it is world-readable, as it should be. When the server has been set
    > to use customer .htaccess files, nothing more needs to be done than to upload
    > a correct .htaccess file and check the protections (read access to all).
    >


    Thanks! I think this is now both well explained and understood.
    I will send an email to Elisa, but same as Yucca seem to think, I am not
    too optimistic on getting positive reactions.


    I myself work on standardisation of broadcast security solutions, and
    have learned at least that security can not be achieved by obscurity
    (yes, some of the world's main broadcast security vendors still seem to
    build their philosophy on "security by obscurity").
    I know Yucca didn't mean this, but couldn't resist on adding the comment
    since the words were in his mail...


    MP
     
    MP, Apr 11, 2006
    #13
  14. MP

    Andy Dingley Guest

    MP wrote:

    > And if the answer is "Simply upload the file, that's all!", then either
    > (i) my ISP doesn't allow me to use .htaccess,


    Then it looks like you have fallen into the (really rather rare)
    combination of Apache and clueless admins who've gone to some trouble
    to stop you changing this.

    Change hosting company. You want to work with people who have a clue
    and there's hardly a shortage.
     
    Andy Dingley, Apr 11, 2006
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. C
    Replies:
    1
    Views:
    297
  2. =?Utf-8?B?am9obno=?=

    Downloading File Includes HTML ???

    =?Utf-8?B?am9obno=?=, Feb 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    588
    bruce barker
    Feb 27, 2004
  3. Replies:
    2
    Views:
    337
    =?ISO-8859-1?Q?Erik_Wikstr=F6m?=
    Aug 29, 2007
  4. michael
    Replies:
    3
    Views:
    166
    Chris McMahon
    Oct 24, 2006
  5. Replies:
    2
    Views:
    167
    GoJakie
    Dec 17, 2008
Loading...

Share This Page