Solved

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

Posted on 2004-10-19
11
480 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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
 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTML Editor That Indents Code As Illustrated 11 141
ASP.NET Fix Column Width 7 210
wordpress plugin to view newspaper 3 59
Best code editor tool for PC 4 132
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
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 Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

685 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