• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Download a file, not show it please !

I have to create a simple HTML page where I must give the possibility to download a (not-compressed) Word Document, there is only one page in this Word document and must stay in Word format.

The usual code is:
<A HRef="myfile.doc">Click here</a> to download this file.

But the problem is that the browser shows the file in a browser window.
I want a normal download process such as the document was named myfile.xxx.

Is there a normal way, or must I compress this file (which is already small enough)?

Is it possible with a special value in the TARGET parameter?

Thanks for any help,

1 Solution
As long as the file has an extension that the browser recognizes, it will display it if the client machine is set that way.  The easiest way would be to put it in a zip file; not to compress it but to make it a file type that the browser won't try and display. Then after unzipping it will be in Word format.  Another option is to change the extension and give the user instructions on changing it back.
You will either have to change the file name extension (by zipping it or just renaming it) or else you could give instructions to right click on the hyperlink that points to the file and select the "Save target as..." option.

This will allow you to download the file without it being opened within the browser.

Use <a href="file://myurlhere.com/myfile.ext"> instead of <a href="http://myurlhere.com/myfile.ext">. This will open up a file/save as dialog box on the user's computer.
NixoAuthor Commented:
The file is always shown in my browser.
But OK, if it's in the browser's config, I'm going to zip this file.

Thanks for these help

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now