.zip files and .rar files?

Discussion in 'HTML' started by fj, Dec 3, 2006.

  1. fj

    fj Guest

    Hi,

    Can anybody tell me why I can link to .zip files on my website but not to
    ..rar files? And how can I link to .rar files?

    Thanks, flip
    fj, Dec 3, 2006
    #1
    1. Advertising

  2. fj

    Ed Seedhouse Guest

    On Sun, 03 Dec 2006 20:54:18 GMT, "fj" <>
    wrote:

    >Hi,
    >
    >Can anybody tell me why I can link to .zip files on my website but not to
    >.rar files? And how can I link to .rar files?


    You can link to any file you want. The browser can't display it
    however, unless it knows about the files type and what application to
    call up for the purpose. Most people don't have .rar viewers so they
    won't be able to do anything with the link except download it.
    Ed Seedhouse, Dec 3, 2006
    #2
    1. Advertising

  3. fj

    fj Guest

    Hi,

    I also tried to link to .exe files but it will not download those files
    either. I've downloaded .exe and .rar files from other sites. The .rar files
    just show as garbled computer language (I think).

    flip

    "Ed Seedhouse" <> wrote in message
    news:...
    > On Sun, 03 Dec 2006 20:54:18 GMT, "fj" <>
    > wrote:
    >
    >>Hi,
    >>
    >>Can anybody tell me why I can link to .zip files on my website but not to
    >>.rar files? And how can I link to .rar files?

    >
    > You can link to any file you want. The browser can't display it
    > however, unless it knows about the files type and what application to
    > call up for the purpose. Most people don't have .rar viewers so they
    > won't be able to do anything with the link except download it.
    >
    >
    fj, Dec 4, 2006
    #3
  4. fj

    Andy Dingley Guest

    fj wrote:
    > I also tried to link to .exe files but it will not download those files
    > either. I've downloaded .exe and .rar files from other sites. The .rar files
    > just show as garbled computer language (I think).


    Then it has linked to the file, but not managed to serve it correctly.

    As a guess (as a I don't know which site you're talking about) then the
    page linking to these files is correct. The server where these files
    are located is incorrect and badly configured.

    Many servers assume that all the files on them are either "HTML" or
    "plaintext", unless they're specific sorts of file (like JPG) that it
    knows about. The "type" of files can be guessed from the file extension
    in their name, but that's not how the web protocols work. Instead they
    have a particular header of "content-type" such as "text/plain",
    "text/html", "image/jpeg" or "application/octet-stream".
    "application/octet-stream" means "We have no idea what this is, just
    treat it as raw data and store it, but don't try to view it, run it or
    do anything clever with it"

    A well-run server should serve file types that it understands
    correctly. It will also need a fallback or default for those it doesn't
    understand, and that should be "application/octet-stream". If the
    server admins want an easy life and no support calls from people
    inventing crazy new file extensions, then the temptation is to set the
    default up as "text/plain" (or even worse, "text/html") and then let it
    serve everything unknown as if it's a viewable text document.

    It looks like the server here understands ZIP files and serves them
    correctly, but it doesn't know about RAR files and so lets them default
    to text/plain. Your browser then sees this (as instructed) as a
    viewable text file and tries to view it.

    If you have to link to such a file and download it, then one quick hack
    is to find a link to it, then instead of following that link and trying
    to save it, instead don't follow the link but just use your browser's
    "Save link as..." feature (try the right-mouse menu).
    Andy Dingley, Dec 4, 2006
    #4
  5. fj

    fj Guest

    Thanks,

    flip

    "Andy Dingley" <> wrote in message
    news:...
    >
    > fj wrote:
    >> I also tried to link to .exe files but it will not download those files
    >> either. I've downloaded .exe and .rar files from other sites. The .rar
    >> files
    >> just show as garbled computer language (I think).

    >
    > Then it has linked to the file, but not managed to serve it correctly.
    >
    > As a guess (as a I don't know which site you're talking about) then the
    > page linking to these files is correct. The server where these files
    > are located is incorrect and badly configured.
    >
    > Many servers assume that all the files on them are either "HTML" or
    > "plaintext", unless they're specific sorts of file (like JPG) that it
    > knows about. The "type" of files can be guessed from the file extension
    > in their name, but that's not how the web protocols work. Instead they
    > have a particular header of "content-type" such as "text/plain",
    > "text/html", "image/jpeg" or "application/octet-stream".
    > "application/octet-stream" means "We have no idea what this is, just
    > treat it as raw data and store it, but don't try to view it, run it or
    > do anything clever with it"
    >
    > A well-run server should serve file types that it understands
    > correctly. It will also need a fallback or default for those it doesn't
    > understand, and that should be "application/octet-stream". If the
    > server admins want an easy life and no support calls from people
    > inventing crazy new file extensions, then the temptation is to set the
    > default up as "text/plain" (or even worse, "text/html") and then let it
    > serve everything unknown as if it's a viewable text document.
    >
    > It looks like the server here understands ZIP files and serves them
    > correctly, but it doesn't know about RAR files and so lets them default
    > to text/plain. Your browser then sees this (as instructed) as a
    > viewable text file and tries to view it.
    >
    > If you have to link to such a file and download it, then one quick hack
    > is to find a link to it, then instead of following that link and trying
    > to save it, instead don't follow the link but just use your browser's
    > "Save link as..." feature (try the right-mouse menu).
    >
    >
    fj, Dec 4, 2006
    #5
  6. Andy Dingley wrote:
    > fj wrote:
    >> I also tried to link to .exe files but it will not download those files
    >> either. I've downloaded .exe and .rar files from other sites. The .rar files
    >> just show as garbled computer language (I think).

    >
    > Then it has linked to the file, but not managed to serve it correctly.
    >
    > As a guess (as a I don't know which site you're talking about) then the
    > page linking to these files is correct. The server where these files
    > are located is incorrect and badly configured.
    >
    > Many servers assume that all the files on them are either "HTML" or
    > "plaintext", unless they're specific sorts of file (like JPG) that it
    > knows about. The "type" of files can be guessed from the file extension
    > in their name, but that's not how the web protocols work. Instead they
    > have a particular header of "content-type" such as "text/plain",
    > "text/html", "image/jpeg" or "application/octet-stream".
    > "application/octet-stream" means "We have no idea what this is, just
    > treat it as raw data and store it, but don't try to view it, run it or
    > do anything clever with it"
    >


    Aside of adding the mime type via an .htaccess file could he not simply
    add the TYPE attribute to his link?

    <a href="someRarFile.rar" type="application/x-rar-compressed">The RAR
    File</a>


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Dec 4, 2006
    #6
  7. fj

    Andy Dingley Guest

    Jonathan N. Little wrote:

    > Aside of adding the mime type via an .htaccess file could he not simply
    > add the TYPE attribute to his link?
    >
    > <a href="someRarFile.rar" type="application/x-rar-compressed">The RAR
    > File</a>


    This rather depends on how much you admin. If you control the link page
    but not the storage, then this is indeed a useful approach.

    If you control the server that serves the actual content though, you
    should fix it up (maybe through .htaccess) so that the content is
    served correctly, no matter how the user gets to that URL or which link
    (if any) they followed.
    Andy Dingley, Dec 4, 2006
    #7
  8. Andy Dingley wrote:

    > If you control the server that serves the actual content though, you
    > should fix it up (maybe through .htaccess) so that the content is
    > served correctly, no matter how the user gets to that URL or which link
    > (if any) they followed.
    >


    I offered this because some to not have access to .htaccess.
    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Dec 4, 2006
    #8
  9. fj

    Toby Inkster Guest

    Jonathan N. Little wrote:

    > <a href="someRarFile.rar" type="application/x-rar-compressed">The RAR
    > File</a>


    Correct me if I'm wrong, but isn't this considered "advisory" -- i.e. once
    the link has been followed, the real HTTP header over-rides it?

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, Dec 5, 2006
    #9
  10. Toby Inkster wrote:
    > Jonathan N. Little wrote:
    >
    >> <a href="someRarFile.rar" type="application/x-rar-compressed">The RAR
    >> File</a>

    >
    > Correct me if I'm wrong, but isn't this considered "advisory" -- i.e. once
    > the link has been followed, the real HTTP header over-rides it?
    >



    Not sure, have to do further research, however it does seem to work in
    tests....

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Dec 5, 2006
    #10
  11. Toby Inkster wrote:
    > Jonathan N. Little wrote:
    >
    >> <a href="someRarFile.rar" type="application/x-rar-compressed">The RAR
    >> File</a>

    >
    > Correct me if I'm wrong, but isn't this considered "advisory" -- i.e. once
    > the link has been followed, the real HTTP header over-rides it?
    >


    Nope I was wrong, I did some further testing and yes you have to set the
    HTTP header that the server sends.

    The OP would either have to contact his sysadmin hand have them add the
    MIME for RAR or if he is allowed to add it himself via the .htaccess

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Dec 5, 2006
    #11
    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. Alex Hunsley
    Replies:
    1
    Views:
    593
    Andrew Thompson
    Sep 16, 2004
  2. John Smith

    RAR Files

    John Smith, Sep 19, 2005, in forum: Java
    Replies:
    8
    Views:
    17,697
    jeev81
    Jan 6, 2010
  3. dongdong
    Replies:
    5
    Views:
    549
    dongdong
    Mar 8, 2006
  4. Tim

    7-zip or rar lib?

    Tim, Nov 17, 2005, in forum: Ruby
    Replies:
    4
    Views:
    106
    Josef 'Jupp' SCHUGT
    Nov 18, 2005
  5. Xarc

    Can I open RAR files?

    Xarc, May 22, 2007, in forum: Ruby
    Replies:
    5
    Views:
    115
    Xarc Asda qwerty
    May 23, 2007
Loading...

Share This Page