Solved

Download File link - Easy Question

Posted on 2001-06-20
20
138 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
  • 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
 
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
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!

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

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

12 Experts available now in Live!

Get 1:1 Help Now