Apache Server configuration support - .htaccess / make files downloadable

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > January 2004 > .htaccess / make files downloadable





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author .htaccess / make files downloadable
Bart Van der Donck

2004-01-28, 8:34 am

Hello,

I made a directory where a visitor can download some files (Apache on
FreeBsd).

Between these files are also html,txt,gif,jpg.... etc
How can I make all those files "downloadable" so that they are not
shown to
the browser screen, but I get a window that says to download it and
save to local drive?

I did a bit of research and found out that it should be arranged with
a
..htaccess directive. However I did not manage to get it working. (My
provider does not allow me to edit httpd.conf)

Thanks for hints or tips
Bart
Richard Antony Burton

2004-01-28, 9:34 am


"Bart Van der Donck" <bart@nijlen.com> wrote in message
news:b5884818.0401281324.1b7e0f00@posting.google.com...
quote:

> Between these files are also html,txt,gif,jpg.... etc
> How can I make all those files "downloadable" so that they are not
> shown to
> the browser screen, but I get a window that says to download it and
> save to local drive?



These files are downloadable, that's what the browser does. In fact it does
exactly the same thing (from the servers point of view) if it popups up a
download dialog or if it downloads it and displays it in the browser window.

It is the browser that decides if it will display it or if it will offer to
save it. You could set the mimetype of files to be something other than the
appropriate one (e.g. application/octet-stream) which may cause the browser
to ask for a download location, but that really is browser dependant.

Richard.


Bart Van der Donck

2004-01-28, 7:33 pm

"Richard Antony Burton" wrote:
quote:

> These files are downloadable, that's what the browser does. In fact it does
> exactly the same thing (from the servers point of view) if it popups up a
> download dialog or if it downloads it and displays it in the browser window.
>
> It is the browser that decides if it will display it or if it will offer to
> save it. You could set the mimetype of files to be something other than the
> appropriate one (e.g. application/octet-stream) which may cause the browser
> to ask for a download location, but that really is browser dependant.



Thank you for the answer. Yes I was thinking the same because indeed
it is the browser that decides what to do with the file when it is
received.
My client environment is Internet Explorer 5+.

Is it possible to put a "application/octet-stream" directive in
..htaccess so that all files are transferred with this mime type ?
I am also wondering if files would not get corrupted, like an
incorrect ascii/binary transfer mode.

Bart
Richard Antony Burton

2004-01-28, 8:33 pm


"Bart Van der Donck" <bart@nijlen.com> wrote in message
news:b5884818.0401290058.43200728@posting.google.com...
quote:

> Is it possible to put a "application/octet-stream" directive in
> .htaccess so that all files are transferred with this mime type ?



Yes, mime type config can be use in .htaccess.
quote:

> I am also wondering if files would not get corrupted, like an
> incorrect ascii/binary transfer mode.



No, they will be transfered as binary. This is fine for fine for text too,
between normal *nix and windows. In the unlikely event you are hosting on an
ebcdic platform, there may be problems with text.

Richard.


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com