Solved

Downloading vs opening a file from a web site...

Posted on 2004-10-19
11
476 Views
Last Modified: 2013-12-24
I'm fairly new to web development, though I am an experienced programmer. I'm developing a web site using FrontPage. I have links to files in the web ... for example, I have a link to a Microsoft Office document. When you click on the link, the document opens. Instead, I would like the user to have the option to either open the file or download it. How do I do this? I can't figure it out and I've been through most of FrontPage help. I think it involves FTP, but whenever I search FrontPage help for ftp, I just get info about how to publish a web site. Thanks.
0
Comment
Question by:alicia1234
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 36

Expert Comment

by:Zyloch
ID: 12353008
Hi alicia1234,

Do you have a server-side language available? You can try setting content-type headers, for example, in PHP, you would have this:

//suppose you have word1.doc. Instead, make a link to word1.php that has this:

<?php
header('Content-type: application/msword');
header('Content-Disposition: attachment; filename="word1.doc"');
readfile('word1.doc');
?>

For Powerpoint, you would use

application/mspowerpoint (I believe)

Excel:

look for your extension, probably .xls in which case it's application/excel
check here: http://www.webmaster-toolkit.com/mime-types.shtml

Regards,
Zyloch
0
 

Author Comment

by:alicia1234
ID: 12353021
Sorry ... I don't understand any of what you've said here. I was hoping that there was some "feature" in FrontPage to do this, and I just hadn't discovered it yet. This web site is being published through a web-hosting service, so I don't "own" the web server.
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12353059
Does your webhosting service have a server-side language you can use? This method is only tricking the browser a bit. In the end, it's the browser's choice what to do with the file, this is just emphasizing that it's, let's say Word, and most browsers are set up to display Word documents in MSWord. I believe you can also set those same headers with <meta> tags but you can't include the word1.doc...
0
 

Author Comment

by:alicia1234
ID: 12353157
I'm not sure if I want to get in to using a server-side language, even if one is available. But you do provide some insight in your answer ... sooooo ... it's actually the browser that figures out whether to open or download a file? But ... for instance ... when I go to the "AdAware" site and download their .exe setup file ... and I get a dialog box that asks if I want to "open" or "save" ... is that my browser doing that or their web site?
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12353205
Not sure about IE, but I do know for Mozilla Firefox, go to Tools->Options->Download->File Types. They're all there :)
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 29

Expert Comment

by:coreybryant
ID: 12353294
You can try to ZIP the file(s) in question & this will prompt the user to download the file(s)

-Corey
0
 
LVL 14

Expert Comment

by:hhammash
ID: 12355763
Hi,

If the files is supported by IE, like (xls, doc,ppt, pdf...etc):

1- Create a zipped copy of the same file
2- Create a popup windows when the user click the link
3- Give the user two options,  open or download
4- Link the "Open" option to the original uzipped file
5- Linke the "Download" option to the zipped copy of the file.

Regards
hhammash
0
 
LVL 14

Expert Comment

by:hhammash
ID: 12355764
Create a small popup using javascript
0
 
LVL 12

Accepted Solution

by:
rcmb earned 250 total points
ID: 12356905
Why not you make a small not beside or below the link that says to download this file
"right click on the hyperlink and select save target as"

It will then download the file.

RCMB
0
 

Author Comment

by:alicia1234
ID: 12358491
To rcmb ... thanks! So simple ... that's what I was looking for! (duh!) ;-)
0
 
LVL 12

Expert Comment

by:rcmb
ID: 12358565
Sometimes we all try to figure out all the ways to do something when the simple way was what you we really looking for.

Thanks for the points and glad to be of some help.

RCMB
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now