Closed Thread Icon

Preserved Topic: creating download Pages that link to <a href="https://ozoneasylum.com/backlink?for=20893" title="Pages that link to Preserved Topic: creating download" rel="nofollow" >Preserved Topic: creating download\

 
Author Thread
wcr one
Paranoid (IV) Inmate

From: seattle
Insane since: Mar 2001

posted posted 05-04-2001 00:00

Quick question:

If I want to set up a page through which someone can download a file from a server, what kind of procedure are we looking at. I am not asking for the code, but just a starting point-language, etc. I am assuming this is server side scripting, am I right about that?

thanks

wcr one

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 05-04-2001 00:03

<a href="file_in_question">Download Now</a>

This is client side, not server side. But it is dependant on type, i.e. file extension, and how they are triggered to work, on both the client side and the server side.

-mage-

wcr one
Paranoid (IV) Inmate

From: seattle
Insane since: Mar 2001

posted posted 05-04-2001 00:11

I would have to say I am a bit confused how an anchor that is supposed to take you somewhere would actually download something to the client computer (but that might be brain damage). Which is not to say I doubt you, it just seems a bit counter intuitive.

well let us say it was a self extracting zipped access97 database? would it be possible? would the client have control over where it was saved on their drive?

thanks



[This message has been edited by wcr one (edited 05-04-2001).]

[This message has been edited by wcr one (edited 05-04-2001).]

JakeB
Paranoid (IV) Inmate

From: us
Insane since: Oct 2000

posted posted 05-04-2001 00:45

when you click on the href it pops up with a window. the user can either run the file from the associated application or save to their harddrrve.

wcr one
Paranoid (IV) Inmate

From: seattle
Insane since: Mar 2001

posted posted 05-04-2001 00:51

Oh, of course, now that makes some sense to me. However, I do not want them to be able to run/open the file, only download. Is this still the direction to take?

thanks

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-04-2001 01:20

What will be done with file(s) depends on web browser (client side). Most web browsers will always ask you to either download & run the file or just to download it, there's no way to override that from your HTML pages...

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 05-04-2001 05:05

Ha, I did get it right... *scurries off back into the corner*

-mage-

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 05-04-2001 05:19

It's true that the client settings dictate how the client handles the file, but it's really based on MIME type HTTP response headers. Because of that, you can control or at least finesse the client behavior somewhat. The user can always hose those associations, but you can play the odds and win.

You can get control by returning a MIME type header manually. Ordinarily, your web server sends a MIME-type header based on its idea of what the file is as defined in httpd.conf. Returning application/octet-stream will cause almost all browsers to undertake a download dialog. The server will also be configured with a default MIME type for files it doesn't recognize (Apache defaults to text/plain, which is usually wrong; application/octet-stream is usually better).

Lets say your file was /foo/bar.baz you could force the mimetype using a .htaccess file in the foo directory. The file needs to say

AddType application/octet-stream .baz

Without that AddType directive (which associates the extension with the MIME type *at the server*), your server will send that file back as the default MIME type. If that's set to text/plain, your user gets a window full of nonsense. With the directive, you take control of the way the server describes the file to the client, thus inderectly influencing the way the client handles the file. You can use this to make text files or HTML files cause a "Save as" dialog.

If you're not running Apache, YMMV.



Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 05-04-2001 14:25

download.com appears to use a javascript that opens a new window, with the file as the code that the window calls (based on a QUICK scan of the source).

Seems to me I saw a page that used a META REFRESH pointing to the file that worked as well.

Pat Richard
A pixel is worth a thousand words.
http://www.gurusnetwork.com
ICQ 23113317

wcr one
Paranoid (IV) Inmate

From: seattle
Insane since: Mar 2001

posted posted 05-04-2001 17:18

Well thanks to all for the help. quite sure I did not understand all of what linear was talking about, but it is full of info and I think I can move along from here.

and don't worry mage, I did not doubt you were right, just suprised that was how it would work. Had not heard that before.

thanks again

« BackwardsOnwards »

Show Forum Drop Down Menu