Click here to Skip to main content
11,481,838 members (65,048 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi experts,

i have a page there are many links(anchor) when user click on any link then file should download


<a href="download/image1.jpg"> Download Image1</a>

please help
Posted 8-Feb-13 4:31am
Tadit Dash at 8-Feb-13 9:36am
So, what is the problem?
Wasim1989 at 8-Feb-13 9:38am
when i click on this link file will open in browser instead of download

can u tell me how can i download file without write server side code.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Execute Server side handler from anchor
You can call server side handler and write code there to download the file.
That will be the best technique.
Follow the answer - Download audio file on html anchor link click independant of browser action[^].
One nice article - File Download Using JavaScript[^].

jQuery library for client-side
If you want to do it in client-side better to use jquery.fileDownload.js Library[^].

Wasim1989 at 9-Feb-13 3:18am
Tadit Dash at 9-Feb-13 4:02am
Most welcome...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100