Solved

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

Posted on 2004-10-19
11
479 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

840 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