Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI
I have made a web app where i can upload files, now i want to download files that have been uploaded. All my files are stored on a folder called "Uploads" on the server. When a file is uploaded, its details are recorded in a Mysql database(FileName, FileLength,FileType, DateAdded).

Now i have used a repeater control to get the uploads/attachments details from the database and list them like this:

File Name: Ash.doc
File Type: doc
File Length: 10kb
Date: 12/05/2010

I want to be able to click on the filename above and then be offered to view in web browser or save file to hard disk.

How do i go about doing this? Can someone please explain and perhaps provide an example. Any help will be much appreciated
Posted

Downloading a file in asp.net:
Downloading a File with a Save As Dialog in ASP.NET[^]

Check the links below, they are about downloading file by clicking LinkButton/ImageButton column in a GridView. You will be able to implement it for Repeater control.

http://forums.asp.net/t/1311359.aspx[^]
http://forums.asp.net/t/1541684.aspx[^]
http://forums.asp.net/t/1539730.aspx[^]

[Added]
And yes this one for your Repeater Control: http://bytes.com/topic/asp-net/answers/424911-how-create-linkbutton-repeater-control-dataset[^]
 
Share this answer
 
v2
I believe you'd need two links or an intermediate page to be able to choose between a download and viewing in the browser. Response.BinaryWrite is how you send a file down, you just set the headers to say if it's a download or viewed in the browser.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900