Solved

Download File link - Easy Question

Posted on 2001-06-20
20
144 Views
Last Modified: 2012-05-04
I need to know how to set a link in my html doc that can download an executable file. It currently tries to open the file. So I have to save it as a zip. I would appreciate the source code. This should be a fairly easy question.

0
Comment
Question by:kingkev
[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
  • 6
  • 5
  • 3
  • +4
20 Comments
 
LVL 18

Expert Comment

by:bruno
ID: 6211282
it tries to open an .exe file?

what browser?  this will depend a lot more on browser than any code you will use...

check http://www.experts-exchange.com/jsp/qShow.jsp?ta=webdevgen&qid=20138253  for some more info on a problem similiar to this...


BRUNO
0
 

Author Comment

by:kingkev
ID: 6211311
Browser is IE5

the hyperlink is set to : filename.exe

When I click on the filename I get a page full of code garbage like the link has tried to run it and it opened it up on a new page like text.

0
 

Expert Comment

by:webdude
ID: 6211451
hrm, very strange...

I have links to many .exe's and they are all fine. What SHOULD happen, is similar to a .zip file, so when the user clicks the link then they are prompted to either OPEN OR Save to disk, with save being default.

This should work fine:

<a href="filename.exe">clik here</a>

thats it! hope it helps
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:bruno
ID: 6211839
this sounds like some sort of browser quirk....
0
 

Author Comment

by:kingkev
ID: 6212238
This is what I have........

<a href="Filename.exe">Download</a>

This is what I get......

?yyyPyO???yyy\t!???yyyPyO???yyy/t???yyyh??@Py????yyyVPy???uyyy:u????yyyPeyyy?Au/ ?uyyy???yyyPj-e??yyPy5?@y?q@?A y5?@euyy???yyy\???yyyu<??uyyy\u3??uyyy??uyyy?At<\t t?FF?At<\t\tNeo?<\u?Ny?u:t :Et :Au?u.uFyu??&??yyyPy??u\?uF??yyyP??
0
 
LVL 17

Expert Comment

by:dorward
ID: 6213870
Does it depend on the browser you use? Some browsers listen the the MIME type the server sends, other just guess based on the file extension.

Try setting the mime.types on the server (its currently treating the executable as plain text)
0
 
LVL 1

Expert Comment

by:sageryd
ID: 6214537
Could be that the server has execute permission on that file and thus the file is run on the server instead of being sent to the user, and what you get in the browser is what the executable returns.

//johan
0
 

Author Comment

by:kingkev
ID: 6215184
Yes it has done it with other browsers as well.

How do I change the Mime settings on the server?

The page is hosted at a server that is not owned by me.

0
 
LVL 2

Expert Comment

by:TenTonJim
ID: 6215697
You need to ask the host to set permissions on that directory to "execute".

Jim S.
0
 
LVL 1

Expert Comment

by:sageryd
ID: 6215927
Well actually it's the opposite to what you're saying, Jim, you need to remove the execute permission for the file, otherwise it will execute on the server instead of being sent to the user.

cheers!
0
 

Author Comment

by:kingkev
ID: 6216088
I have been told that the reason is that it is sending in binary. I need include a file called htaccess and it would I guess have properties that would help me download my exe.

I anyone has the correct procedures for this you will win the question. Give me an answer before I find in on the net.

Thanks for all you help.

Kev
0
 
LVL 1

Expert Comment

by:sageryd
ID: 6216170
I don't know. The server might have special rules set up for this situation, seems like it's reading permission settings from this "htaccess" file, and applying them thereafter. Or not. Talk to your server admin!


johan
0
 

Author Comment

by:kingkev
ID: 6216203
My server admin told me to use the htaccess file but did not how to use it himself. :)
0
 
LVL 17

Accepted Solution

by:
dorward earned 100 total points
ID: 6216213
Put a text file described below at the top level of your website (in the same directory as your main index.html page) it should automatically work for all subdirectories, if it doesn't then upload the file to the directories with the exe files in them too.


Filename: .htaccess

Content:
AddType application/x-octet-stream exe


(note you should have a blank line at the bottom, some systems don't like it when you finish the file without one)
0
 
LVL 1

Expert Comment

by:sageryd
ID: 6216248
Seems like an answer! :)
0
 
LVL 2

Expert Comment

by:TenTonJim
ID: 6216308
Thanks sageryd for pointing that out.


:)

Jim S.
0
 
LVL 1

Expert Comment

by:sageryd
ID: 6216315
;)
0
 

Expert Comment

by:teacher_mod
ID: 6374561
This question has been abandoned. Would the experts please indicate how
this should be closed out. Is there a comment which should be accepted?
Should the points be split? Should it be reduced to zero points and PAQed?
should it be deleted?  In the absence of direction, the default will be
for me to delete.

TIA for helping to clean up the old questions.

teacher_mod
Community Support Moderator
Experts-Exchange
teacher_mod@experts-exchange.com


0
 

Author Comment

by:kingkev
ID: 6498151
The answer was actually this



AddType application/octet-stream exe
NOT
AddType application/x-octet-stream exe

Close enough
0
 
LVL 17

Expert Comment

by:dorward
ID: 6498237
I think that either are valid. x-octate stream was the default setting on my webserver.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

726 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