473,395 Members | 1,411 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

About link

129 100+
Hello friends,
I have one small doubt but it is so useful to me. I have to prepare one html page, in that i have to give one link so that when i clicked that link the browser must ask to download the file or save to disk. How to do it?
Mar 17 '09 #1
5 1788
Dormilich
8,658 Expert Mod 8TB
you need a file type of the target, that the browser is unable to read. for many file types (e.g. .pdb) this is already the case. for the others you have to tell the browser, that the file should be downloaded using the HTTP Headers. the "Content-Disposition: attachment;" header should do the trick (MIME-type header is also useful), though its implementation depends on a) the script language* b) your access rights.

* some headers may also be set by the server (Apache provides some modules for that)
Mar 17 '09 #2
sasimca007
129 100+
Hai friend,
I understand what you are saying, can you help me with some example please
Mar 17 '09 #3
Dormilich
8,658 Expert Mod 8TB
ok, what server (Apache, IIS, lighttpd, ...) and what server side language (PHP, ASP, Perl, ...) do you use?
Mar 17 '09 #4
sasimca007
129 100+
Apache Server, modperl (or) perl Language
Mar 17 '09 #5
Dormilich
8,658 Expert Mod 8TB
can't really help on Perl, but there should be some header modifying functions.

as for Apache (after some googling) this will force a download
Expand|Select|Wrap|Line Numbers
  1. # in the .htaccess file
  2. # forcing PDFs to download, change the RegEx to the file type you want
  3. <FilesMatch "\.(?i:pdf)$">
  4.   ForceType application/octet-stream
  5.   Header set Content-Disposition attachment
  6. </FilesMatch>
source
Mar 17 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ben | last post by:
Hi all, I want to store unique data about my page visit. This is done using cookie value. In my database, the page name and cookie value(ip address) are both primary keys. This ensures unique...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
40
by: JohnnyCJohnny | last post by:
Is it pretty safe to say that almost all web surfers now use browsers that are Frames compatible? What are most people using these days? IE? Thanks
36
by: Peter Brause | last post by:
Hello, my stylesheet shows different colors for visited, active and hovered links. It works fine in IE 6, but in Opera 7 the color for the active link (red background) is never shown. How to...
2
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
97
by: Cameron Laird | last post by:
QOTW: "Python makes it easy to implement algorithms." - casevh "Most of the discussion of immutables here seems to be caused by newcomers wanting to copy an idiom from another language which...
2
by: wavedancer | last post by:
I am confused about the syntax used in the style sheet that accompanies the website I've inherited and have been asked to tidy up. XHTML is new to me, and I've only used CSS for font and link styles...
1
by: leahleah | last post by:
hi, i am a beginner when it comes to javascript, i would like to have a menu (see examples 1 and 2 below), that folds out to reveal sub links, pushing the other menu items down – and then springs...
2
by: Joey | last post by:
I have written an app in C#/asp.net 2.0 that is a system built to handle a large number of scenarios. Part of that system involves allowing users to download large files. As part of my original...
4
by: Richard Harter | last post by:
I have a couple of questions about the following code fragment: struct list_info { void * first; void * last; }; struct pipe_data_list { void * data; struct agent_port_list * dest;
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.