Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-10-19
11
Medium Priority
?
484 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…

704 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