943,633 Members | Top Members by Rank

Ad:
Dec 1st, 2008
0

Downloading a File

Expand Post »
I am developing a site that will allow the users to download files. The files could be of various types - documents, images, applications, etc. I am using a simple link to offer the download

<A HREF="File_To_Download"> Download </A>

If the browser does not support the type of file being downloaded, it simply offers the user an option to the download the file, exactly what I want.
The problem is if the browser can handle the type of file being download (say image files), it opens the file. I would prefer that it offers the user the option to download all different types of files. How do I achieve this ?

I am not sure if this can be done in HTML, or if I need javascript for that. Hence I am posting in this forum. If javascript is required, that is absolutely fine for me.

Thanks
Similar Threads
Reputation Points: 20
Solved Threads: 10
Junior Poster
aparnesh is offline Offline
193 posts
since Jul 2005
Dec 2nd, 2008
0

Re: Downloading a File

just the regular href will choose to view in the browser based upon what the browser can do

here's a link for javascript to force download
http://www.faqts.com/knowledge_base/view.phtml/aid/4906
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Dec 3rd, 2008
0

Re: Downloading a File

Thanks dickersonka for the link. I checked it out, but it doesn't really help me. For one, the execCommand("SaveAs" ..) supposedly works only for IE, so that solution is unacceptable. Changing the filename to remove the extension part - to me sounds like a bad way of doing things, especially since I am not limited to pdf files only. As for C# and .NET , I am using PHP-Linux, so that doesn't help me.
Reputation Points: 20
Solved Threads: 10
Junior Poster
aparnesh is offline Offline
193 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: negative margins
Next Thread in HTML and CSS Forum Timeline: Help recreating a design





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC