Solved

Download File link - Easy Question

Posted on 2001-06-20
20
139 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

919 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

17 Experts available now in Live!

Get 1:1 Help Now