[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

Download File link - Easy Question

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
kingkev
Asked:
kingkev
  • 6
  • 5
  • 3
  • +4
1 Solution
 
brunoCommented:
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
 
kingkevAuthor Commented:
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
 
webdudeCommented:
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
Independent Software Vendors: 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!

 
brunoCommented:
this sounds like some sort of browser quirk....
0
 
kingkevAuthor Commented:
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
 
dorwardCommented:
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
 
sagerydCommented:
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
 
kingkevAuthor Commented:
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
 
TenTonJimCommented:
You need to ask the host to set permissions on that directory to "execute".

Jim S.
0
 
sagerydCommented:
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
 
kingkevAuthor Commented:
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
 
sagerydCommented:
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
 
kingkevAuthor Commented:
My server admin told me to use the htaccess file but did not how to use it himself. :)
0
 
dorwardCommented:
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
 
sagerydCommented:
Seems like an answer! :)
0
 
TenTonJimCommented:
Thanks sageryd for pointing that out.


:)

Jim S.
0
 
sagerydCommented:
;)
0
 
teacher_modCommented:
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
 
kingkevAuthor Commented:
The answer was actually this



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

Close enough
0
 
dorwardCommented:
I think that either are valid. x-octate stream was the default setting on my webserver.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 6
  • 5
  • 3
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now